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

Discussion: propTypes.string.isNotEmpty #95

Open
billfienberg opened this issue Jul 27, 2017 · 0 comments
Open

Discussion: propTypes.string.isNotEmpty #95

billfienberg opened this issue Jul 27, 2017 · 0 comments
Labels
new validator request Requests for a new kind of validator.

Comments

@billfienberg
Copy link

I was recently working on a component that had a button, and I wanted to make sure that consumers of the component passed a string for the button's aria-label. I am currently using propTypes.string.isRequired, but that is satisfied with an empty string (''). I checked the prop-types documentation, and was disappointed there was no propTypes.string.isNotEmpty.

I realize that an empty string is still a string, and that checking the value of the string is more validation than type-checking. I also realize that it is not difficult to write a custom propType, and that there are 3rd-party propType packages available.

Has this specific topic (propTypes.string.isNotEmpty) ever been publicly discussed as a candidate for prop-types? If so, will you please refer me to any documentation from those previous discussions?

@ljharb ljharb added the new validator request Requests for a new kind of validator. label Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new validator request Requests for a new kind of validator.
Projects
None yet
Development

No branches or pull requests

2 participants