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
Is there a recommended way to generate prop types when the prop-types package is not explicitly imported into each component? For example, in my project, PropTypes is provided as a global through webpack's providePlugin:
So PropTypes is available to any react component—even when it is not imported.
I see the resolveToModule util looks for the prop-types import, and if it is not found, we end up with custom prop types rather than their actual type, like string or bool. It seems I can create a handler to generate prop types even when the prop-types package is not explicitly imported, but is there an already existing handler or other way to do this that addresses this case?
The text was updated successfully, but these errors were encountered:
There is currently no way, but I have already thought about loosening the requirements. So basically if the format is correct (objectexpression in propTypes property, call expression with a known proptypes method and correct arguments T.shape({})) That should be enough to consider this correct proptypes.
Is there a recommended way to generate prop types when the
prop-types
package is not explicitly imported into each component? For example, in my project,PropTypes
is provided as a global through webpack's providePlugin:So
PropTypes
is available to any react component—even when it is not imported.I see the
resolveToModule
util looks for theprop-types
import, and if it is not found, we end up withcustom
prop types rather than their actual type, likestring
orbool
. It seems I can create a handler to generate prop types even when the prop-types package is not explicitly imported, but is there an already existing handler or other way to do this that addresses this case?The text was updated successfully, but these errors were encountered: