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

[new] add PropTypes.literal #396

Closed
wants to merge 1 commit into from
Closed

[new] add PropTypes.literal #396

wants to merge 1 commit into from

Conversation

wojtekmaj
Copy link
Contributor

Currently, to check if value is exactly something, we need to do it in a way that feels a bit hacky:

PropTypes.oneOf([value])

With this proposal, one could use:

PropTypes.literal(value)

to achieve the same thing.

@ljharb
Copy link
Collaborator

ljharb commented Apr 19, 2023

I'm not sure the benefit here is worth the complexity of adding an entirely new propType.

@ljharb ljharb added question new validator request Requests for a new kind of validator. Semver: minor labels Apr 19, 2023
@wojtekmaj wojtekmaj closed this by deleting the head repository Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants