---
title: "@typescript-eslint/prefer-ts-expect-error"
description: "Require `@ts-expect-error` instead of `@ts-ignore`"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "typescript"
aliases: ["typescript-eslint/prefer-ts-expect-error","typescript/prefer-ts-expect-error"]
kind: "problem"
category: "pedantic"
default: "off"
fixable: "yes"
typeAware: false
deprecated: true
---

`@ts-ignore` hides every type error on the next line, forever. When the error is fixed, the comment stays, and the next real error on that line is hidden too. `@ts-expect-error` does the same job, but TypeScript complains once there's no error left to hide, so you know to delete it.

`--fix` replaces `@ts-ignore` with `@ts-expect-error`.

typescript-eslint has deprecated this rule. Use `@typescript-eslint/ban-ts-comment` instead.

## Examples

Reported:

{/* bad */}
```ts
// @ts-ignore: `retries` is missing from the package's types
client.retries = 3;
```

Not reported:

{/* good */}
```ts
// @ts-expect-error: `retries` is missing from the package's types
client.retries = 3;
```

## When not to use it

`@typescript-eslint/ban-ts-comment` covers this and the other `@ts-` comments. If you use it, you don't need this rule.
