目录

@typescript-eslint/no-implicit-any-catch

Disallow usage of the implicit any type in catch clauses.

This rule applies only to .js and .ts files.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-implicit-any-catch": "error"
  }
}

Options

By default, this rule does not allow the implicit any type. However, the {"allowExplicitAny": true} object can be accepted as a rule parameter to allow the explicit any type.

Example:

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-implicit-any-catch": ["error", {"allowExplicitAny": true}]
  }
}

The following is not considered a warning with {"allowExplicitAny": true}.

try {
  // ...
} catch (e: any) {
  // ...
}

Example of Correct Code

try {
  // ...
} catch (e: unknown) {
  // ...
}

Example of Incorrect Code

try {
  // ...
// By default, the implicit any type is not allowed.
} catch (e) {
  // ...
}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.