-
Notifications
You must be signed in to change notification settings - Fork 349
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
feat: add an option to disable Exact types #456
feat: add an option to disable Exact types #456
Conversation
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.
I'm still a little bummed about not finding a way for your mapped types to keep these, but am not coming up with anything ... i.e. a way to pass long / "look up" the "appropriate" / "contextual" DeepPartial
from a given message.
On another project, I've made fake properties, i.e.:
class Foo {
__types: { encoder: FooEncoder, decoder: FooDecoder }
}
And then always just set __types: null!
because it's not actually used at runtime, but is just a way for mapped types to look into __types
and grab what it needs.
For that project, the __types
approach was more appropriate, but it seems more icky here, sitting on protobuf message types... 🤷
But yeah, this is a cheap option to add, so why not/makes sense. Maybe add it to the readme, just in case others run into issues with Exact
?
The hardest problem is preserving the trick with generic parameter required for Things might get better if/when TypeScript supports exact types natively :)
I've updated the readme, could you review it please? |
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.
Looks great, thanks @aikoven !
# [1.97.0](v1.96.1...v1.97.0) (2021-12-30) ### Features * add an option to disable Exact types ([#456](#456)) ([9c53d7e](9c53d7e))
🎉 This PR is included in version 1.97.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #454