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

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
Contributor

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
Contributor

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

No branches or pull requests

3 participants