Typescript: Invalidate unnecessary 'as any' and '@ts-ignore'

Created on 14 Mar 2020  路  3Comments  路  Source: microsoft/TypeScript

TypeScript type system is not easy. Errors are often undecipherable. There is no shame to use as any or @ts-ignore because YOLO is the real thing. Especially after days spent hunting compiler bugs.

But TypeScript and its ecosystem is smarter day by day. Some old as any or @ts-ignore maybe are not required anymore.

TypeScript should detect it.

Most helpful comment

Not sure if first one is doable or reasonable, however second point us already implemented.
Use //@ts-expect-error https://github.com/microsoft/TypeScript/pull/36014

All 3 comments

Not sure if first one is doable or reasonable, however second point us already implemented.
Use //@ts-expect-error https://github.com/microsoft/TypeScript/pull/36014

For the first one you might want to try the wotan linter.

@IllusionMH Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manekinekko picture manekinekko  路  3Comments

uber5001 picture uber5001  路  3Comments

CyrusNajmabadi picture CyrusNajmabadi  路  3Comments

Roam-Cooper picture Roam-Cooper  路  3Comments

dlaberge picture dlaberge  路  3Comments