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

Adopt ESLint rules to prevent unsafe use of any #75

Open
felixfbecker opened this issue Apr 7, 2020 · 0 comments
Open

Adopt ESLint rules to prevent unsafe use of any #75

felixfbecker opened this issue Apr 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@felixfbecker
Copy link
Contributor

felixfbecker commented Apr 7, 2020

These are recent additions to @typescript-eslint. Will potentially require refactoring, but will make our codebase safer.

Some major cases where we currently use any:

  • catch clauses. We should use type guards to check the error type and asError() if we want the message.
  • Custom type guards. This is currently difficult because the in operator cannot narrow types from unknown. Composing type guards would work though, we should look into adopting a library like https://github.com/sindresorhus/is (and make sure it has functions and types expressive enough for us)
  • HTTP responses. We should use explicit casts.
@felixfbecker felixfbecker added the enhancement New feature or request label Apr 7, 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

1 participant