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

Rule to enforce parameter type declaration of unknown for catchError() #49

Closed
felixfbecker opened this issue Jul 10, 2020 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@felixfbecker
Copy link

The time has finally come that TypeScript v4 added the ability to explicitly declare catch bindings as unknown instead of any and the next version of typescript-eslint will come with a rule to enforce the usage of unknown for all catch clauses, finally making them type safe.

The only puzzle piece missing then is the same for catchError() bindings in Rx. These are any in the typings by default (the same as with TypeScript v4's catch clauses), but them being any, they can be manually declared to be unknown instead. It would be awesome to have a rule that enforces this, with an autofixer. It should also forbid any other types to be used (those can be explicitly casted if needed).

@cartant cartant added the enhancement New feature or request label Jul 10, 2020
@cartant
Copy link
Owner

cartant commented Jul 12, 2020

There is now a no-implicit-any-catch rule in this package - to handle catchError operators - and there's a no-implicit-any-catch rule in eslint-plugin-etc, too - to handle promise rejections in catch and then calls.

@cartant cartant closed this as completed Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants