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

Is it possible to disallow properties not defined in Component.propTypes? #84

Closed
croraf opened this issue Jun 29, 2017 · 4 comments
Closed

Comments

@croraf
Copy link

croraf commented Jun 29, 2017

If i have the following properties definition, and I pass a property onMove to the component it will not throw error or warning. Is it possible to disallow properties not defined in Component.propTypes?

Component.propTypes = {
    onClick: PropTypes.func,
    rejected: PropTypes.bool
};
@ljharb
Copy link
Collaborator

ljharb commented Jun 29, 2017

Use PropTypes.exact, or the prop-types-exact package.

@aweary
Copy link
Contributor

aweary commented Jun 29, 2017

👍 , but a heads up that ProTypes.exact was temporarily reverted due to some missing infrastructure, but should be back soon and in the next release.

@croraf
Copy link
Author

croraf commented Jun 29, 2017

Can you show example of usage, because I cannot find it in documentation?

@ljharb
Copy link
Collaborator

ljharb commented Feb 21, 2019

#87 re-added exact including docs for it.

@ljharb ljharb closed this as completed Feb 21, 2019
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