microsoft / microsoft/TypeScript
Stripping types should include ts-ignore comments
Open
Nobody has claimed this yet.
Awaiting More Feedback
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript 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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example in the linked TypeScript Playground and compare the emitted JavaScript with the expected behavior. Trace the compiler path responsible for stripping types and comments, then verify that @ts-ignore is removed while the ordinary comment remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100