Arc's @arc-fusion/prop-types overrides/extends the standard React prop-types module to add Arc-specific custom types. However, rather than extending the existing checkPropTypes function that exists in the standard React prop-types module to handle Arc's custom types, @arc-fusion/prop-types simply excludes this function entirely:
const isPropTypeSelfRef = (key) => ['PropTypes', 'checkPropTypes'].includes(key)
const ignorePropTypeSelfRefs = (key) => !isPropTypeSelfRef(key)
const FusionPropTypes = Object.assign(
...Object.keys(PropTypes)
.filter(ignorePropTypeSelfRefs)
.map(key => ({ [key]: taggable(PropTypes[key], key) })),
require('./custom-types')
)
This present a problem when using other libraries that use the prop-types module and expect the checkPropTypes function to exist. For example, when I try to use the Downshift library, I get this error:
Uncaught TypeError: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.checkPropTypes is not a function
validatePropTypes downshift.esm.js:3125
useCombobox downshift.esm.js:3257
Autocomplete default.jsx:20
React 16
render index.js:55
EventListener.handleEvent* index.js:80
js react.js:984
__webpack_require__ react.js:20
<anonymous> react.js:84
<anonymous> react.js:87
downshift.esm.js:3125:14
I would like the arc-fusion/prop-types module to extend the checkPropTypes function so that it is compatible with other third party libraries that expect it to exist and function as intended.
Thanks for this suggestion! We'll definitely look into adding this functionality for our prop-types package, as we want to keep the API surface as similar to the original PropTypes package as possible.