-
Notifications
You must be signed in to change notification settings - Fork 11
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
The future of runtime type assertions in node-groupme #57
Comments
Why not make a debug mode? Add an argument to the constructor, and then if that argument is true, then and only then check typing |
debug mode or a type checking flag would be the best of both worlds, but it still requires generating transformers, which I'm still not entirely sure how to do the ones in I haven't looked too much into transformers, but if anyone is particularly attached to them and knows of a library that can easily be integrated into the types package for this purpose, I'd be more than happy to take suggestions and see if we can work something out |
Type assertions are great for making sure that our (homemade) types are accurate and fully in sync with what the API sends and expects from us. However, there's a case to be made against validating json structures during runtime.
I would appreciate any feedback/suggestions as to whether we should continue using type checkers since it is a major design decision both for node-groupme and for the groupme-api-types repository.
Pros
For example, the type of
APIGroup#join_question
is currently set tonull
because my sample set (the groups I was in at the time) didn't have any join questions when I wrote those types. As a result, node-groupme currently throws an error upon trying to fetch groups with a join question set:This is valuable because it lets us immediately know that the types are wrong and fix them. However, it is worth considering whether this is worth the costs of type checking every single request.
Cons
Currently I am leaning toward discontinuing the transformers as we transition to groupme-api-types. Any thoughts or opinions on this one way or the other are appreciated.
The text was updated successfully, but these errors were encountered: