Skip to content

Commit

Permalink
[Fix] prop-types: props missing in validation when using ComponentPro…
Browse files Browse the repository at this point in the history
…psWithRef from a namespace import
  • Loading branch information
corydeppen committed Dec 29, 2024
1 parent 5c816ed commit 76a0e35
Show file tree
Hide file tree
Showing 2 changed files with 322 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/util/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ module.exports = function propTypesInstructions(context, components, utils) {
const defaults = { customValidators: [] };
const configuration = Object.assign({}, defaults, context.options[0] || {});
const customValidators = configuration.customValidators;
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithRef', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
const genericTypeParamIndexWherePropsArePresent = {
ComponentProps: 0,
ComponentPropsWithRef: 0,
ComponentPropsWithoutRef: 0,
ForwardRefRenderFunction: 1,
forwardRef: 1,
Expand Down
Loading

0 comments on commit 76a0e35

Please sign in to comment.