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

Add exact type checker from react native #41

Merged
merged 1 commit into from Jun 6, 2017

Conversation

jamiebuilds
Copy link
Contributor

I adapted createStrictShapeTypeChecker from react native into a PropTypes.exact checker.

This operates exactly the same way as PropTypes.shape except it will warn on additional keys:

check(PropTypes.shape({}), { foo: 1 }); // Okay.
check(PropTypes.exact({}), { foo: 1 }); // Warning!

This is a runtime version of Flow's exact object types:

type shape = { ... };
type exact = {| ... |};

Copy link
Contributor

@aweary aweary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified tests pass locally. LGTM.

@aweary aweary merged commit 8265af5 into facebook:master Jun 6, 2017
@aweary aweary added this to the 15.6 milestone Jun 6, 2017
gaearon added a commit that referenced this pull request Jun 15, 2017
@gaearon
Copy link
Contributor

gaearon commented Jun 15, 2017

I reverted in #80 because the review missed a few breakages related to how this repo is setup (sorry they're not obvious 😞 ).

Happy to take it back once they're addressed!

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

Successfully merging this pull request may close these issues.

None yet

4 participants