Microsoft/TypeScript
GitHub で見るts-expect-error is reported as unused on rootDir error
Open
#48,850 opened on 2022年4月26日
BugDomain: Something ElseEffort: ModerateHelp Wanted
Repository metrics
- Stars
- (48,455 stars)
- PR merge metrics
- (平均マージ 6d 17h) (30d で 9 merged PRs)
説明
Bug Report
ts-expect-error cannot be used to silent a ts(6059, rootDir not containing all the files) error.
| with directive | without directive |
|---|---|
🔎 Search Terms
ts-expect-error, rootDir, 6059
🕗 Version & Regression Information
TypeScript 4.6.3.
- This is a crash
- This changed between versions ______ and _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because this involves tsconfig.json.
⏯ Playground Link
https://github.com/proteriax/ts-expect-error-bug
💻 Code
See reprod repo above.
// We can quickly address your report if:
// - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
// - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
// - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
// - We have to pare too much extraneous code.
// - We have to clone a large repo and validate that the problem isn't elsewhere.
// - The sample is confusing or doesn't clearly demonstrate what's wrong.
🙁 Actual behavior
The error goes away with a // @ts-expect-error above it.
🙂 Expected behavior
See screenshot above. If you have the directive, TypeScript thinks it’s useless; if you don’t, TypeScript will give you an error.