You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.
I've seen some projects that define prop-types in separate files in order to reuse their definitions. The problem is that we can't extend prop-types definitions. Let's say we have a set of prop-types called Person.type.js:
Also, exporting a plain object from 'Person.type.js' is not an option since we may want the ability to use those properties directly, and for the matter of consistency, we may not want to use it like PropTypes.shape(PersonType) (that would be a possible workaround) whenever we use the PersonType directly as a prop.
So would be great to have a method like PropTypes.extend(shape, additionalFields) so we could be able to write something like:
I've seen some projects that define prop-types in separate files in order to reuse their definitions. The problem is that we can't extend prop-types definitions. Let's say we have a set of prop-types called
Person.type.js
:The problem is that we can't do something like:
Also, exporting a plain object from 'Person.type.js' is not an option since we may want the ability to use those properties directly, and for the matter of consistency, we may not want to use it like
PropTypes.shape(PersonType)
(that would be a possible workaround) whenever we use the PersonType directly as a prop.So would be great to have a method like
PropTypes.extend(shape, additionalFields)
so we could be able to write something like:The text was updated successfully, but these errors were encountered: