Skip to content

Commit 227a3e0

Browse files
committed
Improve ts expect error comment
1 parent eae30c4 commit 227a3e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/mui-utils/src/getElementRef/getElementRef.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ export default function getElementRef(element: React.ReactElement<any>): React.R
1010
if (!element || !React.isValidElement(element)) {
1111
return null;
1212
}
13+
1314
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
1415
return (element.props as any).propertyIsEnumerable('ref')
1516
? (element.props as any).ref
16-
: // @ts-expect-error child.ref is incompatible with types prior to React 19
17+
: // @ts-expect-error element.ref is not included with ReactElement type, even though it exists
1718
element.ref;
1819
}

0 commit comments

Comments
 (0)