This rule requires an explicit type annotation for error parameters in promise catch callbacks. It's similar to the TypeScript no-implicit-any-catch rule, but is for promises - not try/catch statements.
Examples of incorrect code for this rule:
Promise
.reject(new Error("Kaboom!"))
.catch(error => console.log(error));Examples of correct code for this rule:
Promise
.reject(new Error("Kaboom!"))
.catch((error: unknown) => console.log(error));This rule accepts a single option which is an object with an allowExplicitAny property that determines whether or not the error variable can be explicitly typed as any. By default, the use of explicit any is forbidden.
{
"etc/no-implicit-any-catch": [
"error",
{ "allowExplicitAny": true }
]
}