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
We use Babel to transpile our TS to better work with other tools in the ecosystem (such as Emotion or Jest), but we'd also still like to generate declaration files so consumers of our libraries can enjoy the type information.
However, when trying to follow the advice of adding isolatedModules to our config, we get the following warning:
tsconfig.json:5:5 - error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'.
5 "declaration": true,
~~~~~~~~~~~~~
Use Cases
As mentioned, I'd like to create declaration files for libraries who are transpiled using babel. I'd also like to make sure that whatever guarantees isolatedModules adds to allowed syntax are present, outside of the type information.
Babel itself will complain if we use e.g. const enum, but that only happens at compile time - isolatedModules will also show a warning in the IDE while writing the code.
Examples
Same as we currently get with {"declaration": true, "emitDeclarationOnly": true}, but with added {"isolatedModules": true}.
Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)