-
Notifications
You must be signed in to change notification settings - Fork 329
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
Non-Destructive Type Assertion #422
Comments
@cyberixae not sure I'm following, looks like a workaround for a TypeScript feature rather than something related to |
You are right. It is a convenience feature. And it could be made obsolete by introducing a similar convenience feature to TypeScript. I started a Stack Overflow thread to gather more information of the current situation. https://stackoverflow.com/questions/60298695/non-destructive-type-assertions-in-typescript/60298919 |
I started working on my own convenience wrapper and added this feature in the wrapper as |
🚀 Feature request
Current Behavior
Consider the following type and decoder.
The codec is only interested in whether or not it's input has a name.
Using the type directly would disallow other fields from being included.
While using decode would introduce an unnecessary
Either
.Desired Behavior
Being able to assert compliance without introducing an
Either
would be convenient.Suggested Solution
I imagine
assert
could be part of the Decoder interface.Describe alternatives you've considered
Using an IIFE works but is a bit verbose.
The text was updated successfully, but these errors were encountered: