Skip to content

Commit 90a00b9

Browse files
corydeppenljharb
authored andcommitted
[Fix] prop-types: support ComponentPropsWithRef from a namespace import
1 parent 3fd9b92 commit 90a00b9

File tree

3 files changed

+324
-1
lines changed

3 files changed

+324
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
99

1010
### Fixed
1111
* [`no-unknown-property`]: allow shadow root attrs on `<template>` ([#3912][] @ljharb)
12+
* [`prop-types`]: support `ComponentPropsWithRef` from a namespace import ([#3651][] @corydeppen)
1213

1314
### Changed
1415
* [Docs] [`button-has-type`]: clean up phrasing ([#3909][] @hamirmahal)
1516

1617
[#3912]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3912
1718
[#3909]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3909
19+
[#3651]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3651
1820

1921
## [7.37.4] - 2025.01.12
2022

lib/util/propTypes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ module.exports = function propTypesInstructions(context, components, utils) {
107107
const defaults = { customValidators: [] };
108108
const configuration = Object.assign({}, defaults, context.options[0] || {});
109109
const customValidators = configuration.customValidators;
110-
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
110+
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithRef', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
111111
const genericTypeParamIndexWherePropsArePresent = {
112112
ComponentProps: 0,
113+
ComponentPropsWithRef: 0,
113114
ComponentPropsWithoutRef: 0,
114115
ForwardRefRenderFunction: 1,
115116
forwardRef: 1,

0 commit comments

Comments
 (0)