Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs about useUnknownInCatchVariables #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/rules/no-implicit-any-catch.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use type-safe error callbacks (`no-implicit-any-catch`)

This rule requires an explicit type annotation for error parameters in promise `catch` callbacks. It's similar to the TypeScript [`no-implicit-any-catch`](https://github.com/typescript-eslint/typescript-eslint/blob/e01204931e460f5e6731abc443c88d666ca0b07a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md) rule, but is for promises - not `try`/`catch` statements.
This rule requires an explicit type annotation for error parameters in promise `catch` callbacks. It's similar to TypeScript 4.4's [`useUnknownInCatchVariables`](https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables) but is for promises - not `try`/`catch` statements.

## Rule details

Expand Down Expand Up @@ -35,8 +35,10 @@ This rule accepts a single option which is an object with an `allowExplicitAny`

## Related

- [`no-implicit-any-catch`](https://github.com/typescript-eslint/typescript-eslint/blob/e01204931e460f5e6731abc443c88d666ca0b07a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md)
- [`useUnknownInCatchVariables`](https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables) for catching a similar issue in `try`/`catch` statements
- [`no-implicit-any-catch`](https://github.com/typescript-eslint/typescript-eslint/blob/e01204931e460f5e6731abc443c88d666ca0b07a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md) - a now-deprecated lint rule that did the same thing for `try`/`catch` statements before `useUnknownInCatchVariables` was added


## Further reading

- [Catching Unknowns](https://ncjamieson.com/catching-unknowns/)
- [Catching Unknowns](https://ncjamieson.com/catching-unknowns/)