-
Notifications
You must be signed in to change notification settings - Fork 2
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
Website: fix any
types
#3451
Comments
In terms of priority, I think this isn't super high up, while it's nice to have everything fully typed, if it's not easy to fix then I don't think we should invest a lot of time. I can't think of any bugs/runtime type errors we've had due to use of any. Good point to consider |
I had a look at it and saw some things that I touched recently and quickly fixed a few things here: #3464 The remaining things are almost all in the
maybe not, but I think this point is still quite valid:
I find reasoning about the I can't speak to the priority of this, just wanted to emphasize the maintainability aspect again (as opposed to a strictly runtime-error-focused PoV). The |
Thanks for fixing some, that's definitely good! For lapis search parameters, the real issue, I think, is the fact that Zodios spits out opaque types that are hard to work with. It's easy to look at LAPIS docs/swagger and see what the URL should be. It's hard to get a get/post to that URL with Zodios, it's not because of lack of typing, it's often precisely because of typing that it feels hard (at least to me). Zodios seems like a nice experiment but not really something to use in production, we should go with simple react query hooks for which there is plenty of documentation (instead of Zodios which is unmaintained and not too widely used). Here's an example: Zodios technically just wraps around react query, but in such a weird way that it's easy to forget. Because it's not clear that it's actually react query under the hood we get patterns like this on the left: https://github.com/loculus-project/loculus/pull/3449/files#diff-5c10907a31647a2beff344b171ce8b089c4d29f436e83c764767ae9947d64c93 It's actually strange we need to use |
#3450 introduced a number of eslint ignore comments for the rule
@typescript-eslint/no-explicit-any
.any
is harmful, because it essentially disables Typescript checks. You can access any method or field without Typescript complaining. In the long term it generates code that is harder to maintain (adding new features and refactoring becomes more dangerous because the type system can't guide you).All of those should be fixed:
unknown
and make sure that the variable has a certain type before using it.any
by a concrete type that is more useful.See TODO comments in the code that reference this issue. Possibly split this issue into smaller subtasks.
The text was updated successfully, but these errors were encountered: