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

Invalid custom inputTypes are not rejected #108

Open
KingMob opened this issue Feb 20, 2018 · 2 comments
Open

Invalid custom inputTypes are not rejected #108

KingMob opened this issue Feb 20, 2018 · 2 comments

Comments

@KingMob
Copy link

KingMob commented Feb 20, 2018

Pass in anything that's not a React Component to addInputType, and no exceptions will be thrown.

One issue is that ! has higher precedence than instanceof. So, in addInputType, the line:

!React.Component instanceof instance.constructor

is actually negating React.Component, not the result of the instanceof test.

However, wrapping it in parentheses like !(React.Component instanceof instance.constructor) doesn't fix the overall issue, so I think there's something wrong with the instanceof test, too.

@andrewhathaway
Copy link
Owner

Ahh. This may have been a time thing, those validation checks have probably changed over time, and Winterfell hasn't kept up with that. I'll do some digging on this, and work out what the best validation check is.

Happy to accept PRs too! :)

@KingMob
Copy link
Author

KingMob commented Feb 21, 2018

I was going to submit a PR, but the handful of things I tried didn't work. I'm not too clear on how React's object hierarchy works under the hood, unfortunately. I've mostly left Javascript for Clojurescript these days, so my esoteric knowledge about Js prototype stuff is dwindling...

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

No branches or pull requests

2 participants