@ts-nocheck
and @ts-ignore
should also disable suggestions
#47315
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Suggestion
🔍 Search Terms
@ts-ignore tsserver disable
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
The
// @ts-nocheck
and// @ts-ignore
directive should, also, disable tsserver providing suggestions📃 Motivating Example
When writing code ,it's nice that we get real time compile & linting errors & warnings (i.e. suggestion). TSSERVER, the language server for typescript, dose the heavy-lifting for your favorite IDE and fills your screen with all those wiggly lines you hate (& love).
Sometime, though, the language server can get it wrong. You are using a feature that's too new. You depend on a library unknown to the server. Or that you are writing buggy code intentionally. To our rescue, we can use directives to tell typescript (and its language server) that "it's ok, I know, roll with it". Directives such as
are very handy.
Unfortunately, these directives didn't work with suggestions. Things like
Still populated your IDE, and you jump through them like hoops trying to reach the error you want to fix. They are not ignored by placing the directives.
Released with typescript X.X, these directives can now be used to switch off suggestions as well.
💻 Use Cases
This is a capture from Emacs' lsp-mode. For conventional reasons, we still want to continue using the commonjs style
require
andmodule.exports
in js projects.The text was updated successfully, but these errors were encountered: