-
Notifications
You must be signed in to change notification settings - Fork 194
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
Validate immutable objects #65
Comments
There isn't currently. I haven't tried making a custom |
I have not looked that close at the code yet, so just asking here. Is there any base object that the immutable objects inherit from? Or is the original objects sent in to the Immutable() function changed directly? If there is some base object available, it could just be used for instanceof check in PropTypes and any other case where it might be required to check if an object is immutable.. Something like
given that the function without arguments (or something similar) return a base object |
That could work with objects, but not with arrays; they need to be I'm open to adding a helper function intended to be used with React (as long as it doesn't necessitate a React depdendency!) but I don't want to add an extra step to the creation of every single object - even for people using |
Totally understandable. Unfortunately I don't have the time to contribute with the PR myself at the moment, but maybe in the future. |
I guess we want something that can be used like this:
(If we want to support also |
Is there a way to validate that an array is an immutable array? Like something that would be instanceof for immutable arrays but not for normal mutable arrays.
The use case is actually React.Proptypes validation. Something similar to
I know I can use a custom function in ProtoTypes and use Immutable.isImmutable, but adding a function like that in every component that should receive immutable prop objects, will not be pretty.
The text was updated successfully, but these errors were encountered: