You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add option "typeJs": "module" (default could be "typeJs": "script")
π Motivating Example
In NodeJs we have ability to say which module system we use by setting "type": "module" in package.json
But when I add allowJs option TypeScript compiler treat each js file as plain script and it complains about redeclaration of the same function.
It would be nice instead of renaming each js -> mjs or adding stub export {}; statement to treat each js file as module, to add option, the same way node did
π» Use Cases
It is needed in case for example where in project bunch of scratches js files with some code that do not import or export something at this moment
The text was updated successfully, but these errors were encountered:
redradist
changed the title
Option that understand each js file as module
Option that treat each js file as module
Feb 10, 2021
Suggestion
Add option
"typeJs": "module"
(default could be"typeJs": "script"
)π Search Terms
How to say TypeScript that each js file is a module ?
How treat in TypeScript each js file as module ?
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Add option
"typeJs": "module"
(default could be"typeJs": "script"
)π Motivating Example
In NodeJs we have ability to say which module system we use by setting
"type": "module"
inpackage.json
But when I add allowJs option TypeScript compiler treat each js file as plain script and it complains about redeclaration of the same function.
It would be nice instead of renaming each js -> mjs or adding stub export {}; statement to treat each js file as module, to add option, the same way node did
π» Use Cases
It is needed in case for example where in project bunch of scratches js files with some code that do not import or export something at this moment
The text was updated successfully, but these errors were encountered: