[Typescript] "script" vs "module"
Typescript check a file whether it contains any export/import
, if it is, then it's a module; if not then it's a script.
What's the difference between module vs script
?
Script
Any variable and function declared inside script will be globally available.
Module
Any variable and function devlared inside module is scoped to it's file.
How to force Typescript to treat every file as moudle?
In tsconfig.json, we can enable "moduleDetection": "force"