Stripping types should include ts-ignore comments
See original GitHub issueTypeScript Version: 3.8 latest, playground
Search Terms: remove ts-ignore comment
Code
// this is a comment that should be kept
const message: string = 'hello world';
// the below ts-ignore comment should be removed, since it has no meaning in a non-TS context
// @ts-ignore
console.log(message);
Expected behavior: ts-ignore comment is stripped, other comments are kept.
Actual behavior: all comments are kept including ts-ignore comments.
Related Issues:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TypeScript remove comments | webhint documentation
typescript-config/no-comments checks that the property removeComments is enabled in your TypeScript configuration file (i.e. tsconfig.
Read more >TypeScript compile and keep comments - tsc - Stack Overflow
Since 2015 you can create a tsconfig.json in your project and add "removeComments": false to its "compilerOptions" property in order to keep your...
Read more >API - esbuild
Use of certain JavaScript features can disable many of esbuild's optimizations including minification. Specifically, using direct eval and/or the with statement ...
Read more >TS Playground - An online editor for exploring TypeScript and ...
Disable truncating types in error messages. Emit ... Generate .d.ts files from TypeScript and JavaScript files in your project. ... Disable emitting comments....
Read more >Comments - ts-morph
ts -morph parses out certain kinds of comments to make them easier to work with. This breaks away from the behaviour in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was actually surprised to find
@ts-expect-error
comments in my generated .js files. Like@ts-ignore
, these are pointless outside TypeScript code.I was even running into issues where explicitly escaping a type error with
@ts-expect-error
was compiled to js code where that type error was no longer detected, failing our tests (because the expected error did not occur).