-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not emit files with no statments #10908
Comments
Well.. there is a file called |
Sure, that might work, but if i use declaration: true, it causes some unintended behaviour, as the d.ts file is never built, it's not available in the bunded declaration file. It seems quite weird to me that tsc would emit empty files if no code is generated from it. |
The problem is what happens when you go from a 1-statement file to a 0-statement file during separate compilations -- without emitting the blank file, you might still be loading and executing that 1 statement. |
The empty module still has side effects by its mere existence that you may want to occur. Renaming to .d.ts and piping it through your build manually is the intended workaround if you want a types-only module to not be manifest despite being imported. |
@RyanCavanaugh using |
$ npm install copy -g
$ copy ./src/**/*.d.ts ./dist From the TypeScript Non-Goals:
|
Sure, I know that; but can't there be a |
TypeScript Version: 2.0.2
Code
Expected behavior:
Actual behavior:
note: adding "noImplicitUseStrict": true provides the same result, but without usestrict statement
The text was updated successfully, but these errors were encountered: