Skip to main content

TSC Directive ↔ comment statement as Directive to control TSC behavior on line/file basis

// @ts-ignore

tell TSC to ignore Type-Check for next line only

// @ts-nocheck`

tell TSC to not Type-Check this file

// @ts-check`

tell TSC to check this (JS?) file

// @ts-expect-error

tell TSC to expect & suppress static error on next line

!snippet // @ts-expect-error` with assert.throws()

assert.throws(
// @ts-expect-error: Object is possibly "null". (2531)
() => null.someProperty,
TypeError);

References