-
Notifications
You must be signed in to change notification settings - Fork 536
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
Introduces a Merge<> utility and a type testing pattern #1505
Conversation
|
size-limit report 📦
|
I've been wanting a pattern for testing types for a while now, and this is what I've come up with. I'm very open to feedback about how else to accomplish confidence in our types. Some questions to consider:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! Excellent work, @jfuchs ✨
This is pretty cool @jfuchs! Especially liked the set of tests for a utility like Merge. It works very well. I will definitely write these if I create such utilities. |
@pksjce Thanks for the thoughts! And welcome!
Great question! I agree that many of the happy paths will be covered elsewhere, and as long as CI is running typechecking against those, we'll benefit from that. And I agree that this tool would be the place for negative tests. What I'm not sure about is whether having good coverage in our test suites and stories for a given component would necessarily mean good coverage for the types. What do you think? edit: I'm gonna merge, since it looks like everyone is pretty open to this kind of testing in general. I still look forward to talking about how broadly we expect to use this kind of test |
1afc713
to
02510b0
Compare
02510b0
to
cb448e4
Compare
Co-authored-by: Cole Bemis <colebemis@github.com>
🤔 Is it a pain point within the team that we are constantly running into typing errors during certain situations like integration? Or has it happened a lot that we've broken types during releases?
|
This PR:
src/util/types.ts
into separate files per utilityI still need to:
verify that these tests won't contribute to our built type definitions inedit: turns out these tests do contribute to the built type defs, but so do our unit tests, so i'm going to drop this as a requirement for nowlib
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.