# `deslop/ts-escape-hatch`

Disallow TypeScript suppressions that hide type errors.

- **Category:** Correctness
- **Severity:** warn
- **Source:** deslop-js
- **Framework:** global
- **Enabled when:** react-doctor deadCode analysis enabled (default true); whole-project scan only — skipped in --diff/--staged modes
- **Documentation:** <https://github.com/millionco/deslop-js>

## Validation prompt

Use this to decide whether a fired diagnostic is real or a false positive.

Fires from deslop's typeScriptEscapeHatches on a comment matching one of three kinds: ts-ignore (high confidence: `@ts-ignore` silently swallows the next line's type errors forever), ts-nocheck (medium: `@ts-nocheck` disables type checking for the entire file), or ts-expect-error-without-explanation (low: a `@ts-expect-error` whose trailing text is empty after trimming). Note deslop already excludes any `@ts-expect-error` that has explanatory text on the same line, so a justified inline suppression will not fire. False positive to SUPPRESS: a `@ts-nocheck` at the top of a generated or vendored file (e.g. codegen output, a `.d.ts` shim, a bundled third-party blob) that you do not own and cannot fix at the source — there the file-wide suppression is intentional, not slop.

## Fix prompt

Use this once validation confirms the diagnostic is real.

Replace the suppression with a narrowly-scoped, self-documenting one or fix the underlying type. For ts-ignore, swap to `@ts-expect-error: <why this is okay>` so the suppression breaks loudly once the real error is fixed. For a bare ts-expect-error, append the justification on the same line: `// @ts-expect-error: third-party types are wrong, value is always a string`. For ts-nocheck, delete it and resolve the actual type errors, or if only a few lines are genuinely unsound, drop a per-line `@ts-expect-error: <reason>` on each instead of disabling the whole file. If the value is truly untyped, prefer a real cast or type guard (e.g. `x as Foo` with a comment, or `if (isFoo(x))`) over blanket suppression. See https://github.com/millionco/deslop-js
