ts-expect-error only for a certain type of error

Viewed 1828

Is it possible to make //ts-expect-error directive only cover a concrete error and not others?

Example of code I would like to silent but only for some kind of error:

enter image description here

Error TS2588 enter image description here

Error TS2339 enter image description here

I would expect something like ESLint does with rules: //@ts-expect-error TS2339 to only silent errors of that kind, for example.

1 Answers

It's not currently possible - this has been a long standing request; one of the underlying issues is that the error codes are moving targets, as they're not meant to be used for explicit referencing.

Related