Skip to content
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

How to detect valid prop/session type? #137

Open
pgilad opened this issue Jan 25, 2015 · 0 comments
Open

How to detect valid prop/session type? #137

pgilad opened this issue Jan 25, 2015 · 0 comments
Labels

Comments

@pgilad
Copy link
Member

pgilad commented Jan 25, 2015

Suppose I want to set the value for a model prop or session. How do I detect what is the valid dataType for that attribute?

This is useful when getting e.target.value from inputs, and when type='number' it will fail validation due to the required type being a number. Thus what you should use is e.target.valueAsNumber but you have no way of knowing ahead what is the required data type.

So either model.set should handle the type coercion, or you should be able to somehow determine programmatically the required type and coerce it yourself (something like model.getPropType('amount') --> 'number')

@bear bear added the question label Jan 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants