File tree Expand file tree Collapse file tree 2 files changed +2
-11
lines changed
mui-utils/src/getReactNodeRef Expand file tree Collapse file tree 2 files changed +2
-11
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,13 +8,9 @@ import * as React from 'react';
88 * @returns React.Ref<any> | null
99 */
1010export default function getReactNodeRef ( element : React . ReactNode ) : React . Ref < any > | null {
11- if ( ! element || ! React . isValidElement ( element ) ) {
12- return null ;
13- }
14-
1511 // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
16- return ( element . props as any ) . propertyIsEnumerable ( 'ref' )
17- ? ( element . props as any ) . ref
12+ return ( element as any ) ! . props . propertyIsEnumerable ( 'ref' )
13+ ? ( element as any ) ! . props . ref
1814 : // @ts -expect-error element.ref is not included in the ReactElement type
1915 // We cannot check for it, but isValidElement is true at this point
2016 // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
You can’t perform that action at this time.
0 commit comments