We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It'd be nice to be able to coerce convertible types to other types.
const PersonRecord = Record({ id: String, phone: Coerce(Union(Number, String), String), }, 'Person');
In this hypothetical example if we did the following:
const p1 = PersonRecord({ id: 0, phone: 12318001800 });
accessing p1.phone would give us a string.
p1.phone
We'd have to keep a map of how we get from one type to others. This could be hard-coded or supplied at run-time.
The text was updated successfully, but these errors were encountered:
I like it because it's explicit
Sorry, something went wrong.
I could have a stab at implementing this if you think it would be a worthwhile feature.
I think people will like it. I think @udnisap implemented something similar but didn't put it in a PR.
No branches or pull requests
It'd be nice to be able to coerce convertible types to other types.
In this hypothetical example if we did the following:
accessing
p1.phone
would give us a string.We'd have to keep a map of how we get from one type to others. This could be hard-coded or supplied at run-time.
The text was updated successfully, but these errors were encountered: