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

value validation types #71

Open
dashed opened this issue Jun 6, 2015 · 5 comments
Open

value validation types #71

dashed opened this issue Jun 6, 2015 · 5 comments

Comments

@dashed
Copy link
Contributor

dashed commented Jun 6, 2015

Something like this for immstruct structures
https://github.com/tgriesser/state-types-react
https://facebook.github.io/react/docs/reusable-components.html#prop-validation

API sketch:

const blueprint = {
    foo: immstruct.types.string.isRequired
};

immstruct({
    foo: 'bar'
}, blueprint);
@dashed
Copy link
Contributor Author

dashed commented Jun 6, 2015

Any validation violations would be warnings in the console.

@unindented
Copy link

@dashed Would this fit your use case? https://github.com/HurricaneJames/react-immutable-proptypes

@dashed
Copy link
Contributor Author

dashed commented Jun 8, 2015

@unindented Cool! I'll definitely check this out.

@mikaelbr
Copy link
Member

mikaelbr commented Jun 8, 2015

@dashed Yeah, the question is. Do we think this is something that Immstruct should do, or is this a React thing?

@dashed
Copy link
Contributor Author

dashed commented Jun 8, 2015

@mikaelbr I feel this would help debugging a lot.

I didn't really elaborate on my first post; but I wanted to suggest to 'copy' proptype checking that React does and perform the type check against a Structure instance instead of this.props. That way user can use userland proptypes (e.g. HurricaneJames/react-immutable-proptypes) meant for React, and as well as React's proptypes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants