Microsoft/TypeScript
Vedi su GitHubts-expect-error is reported as unused on rootDir error
Open
#48.850 aperta il 26 apr 2022
BugDomain: Something ElseEffort: ModerateHelp Wanted
Metriche repository
- Star
- (48.455 star)
- Metriche merge PR
- (Merge medio 6g 17h) (9 PR mergiate in 30 g)
Descrizione
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.