Skip to content

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

@felixfbecker

Description

@felixfbecker

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions