Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants