Learning TypeScript @learningtypescript.com · Feb 6

A comment directive is a comment that directs (changes) how a tool operates within a file. TypeScript includes several that can change type checking behavior for a file or on a specific line. The most common are `@ts-expect-error` & `@ts-ignore`, which disable type checking for a line. 2/🧵

2 likes 1 replies

?

Replies

Learning TypeScript · Feb 6

Most of the time, you don't want "disable type checking" comment directives. Type checking is good! Avoiding type errors is good! Sometimes the type checker can be wrong. Types can be incorrect, or there can be a bug or missing feature. If an `any` isn't enough, a comment directive might be. 3/🧵