File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
packages/mui-utils/src/useForkRef Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ import * as React from 'react';
1919export default function useForkRef < Instance > (
2020 ...refs : Array < React . Ref < Instance > | undefined >
2121) : React . RefCallback < Instance > | null {
22- const cleanupRef = React . useRef < void | ( ( ) => void ) > ( undefined ) ;
22+ const cleanupRef = React . useRef < ( ) => void > ( undefined ) ;
2323
24- const refEffect = React . useCallback ( ( instance : Instance | null ) => {
24+ const refEffect = React . useCallback ( ( instance : Instance ) => {
2525 const cleanups = refs . map ( ( ref ) => {
2626 if ( ref == null ) {
2727 return null ;
@@ -37,9 +37,9 @@ export default function useForkRef<Instance>(
3737 } ;
3838 }
3939
40- ( ref as React . RefObject < Instance | null > ) . current = instance ;
40+ ref . current = instance ;
4141 return ( ) => {
42- ( ref as React . RefObject < Instance | null > ) . current = null ;
42+ ref . current = null ;
4343 } ;
4444 } ) ;
4545
@@ -57,11 +57,11 @@ export default function useForkRef<Instance>(
5757 return ( value ) => {
5858 if ( cleanupRef . current ) {
5959 cleanupRef . current ( ) ;
60- ( cleanupRef as React . RefObject < void | ( ( ) => void ) > ) . current = undefined ;
60+ cleanupRef . current = undefined ;
6161 }
6262
6363 if ( value != null ) {
64- ( cleanupRef as React . RefObject < void | ( ( ) => void ) > ) . current = refEffect ( value ) ;
64+ cleanupRef . current = refEffect ( value ) ;
6565 }
6666 } ;
6767 // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- intentionally ignoring that the dependency array must be an array literal
You can’t perform that action at this time.
0 commit comments