File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ type ReadOnlyRefObject<T> = {
7
7
readonly current : T ;
8
8
} ;
9
9
10
+ type UseStateRefValue < T > = [ T , Dispatch < SetStateAction < T > > , ReadOnlyRefObject < T > ] ;
10
11
type UseStateRef = {
11
- < S > ( initialState : S | ( ( ) => S ) ) : [ S , Dispatch < SetStateAction < S > > , ReadOnlyRefObject < S > ] ;
12
- < S = undefined > ( ) : [ S | undefined , Dispatch < SetStateAction < S | undefined > > , ReadOnlyRefObject < S | undefined > ] ;
12
+ < S > ( initialState : S | ( ( ) => S ) ) : UseStateRefValue < S > ;
13
+ < S = undefined > ( ) : UseStateRefValue < S > ;
13
14
} ;
14
15
15
- const useStateRef : UseStateRef = < S > ( initialState ?: S | ( ( ) => S ) ) => {
16
+ const useStateRef : UseStateRef = < S > ( initialState ?: S | ( ( ) => S ) ) : UseStateRefValue < S > => {
16
17
const [ state , setState ] = useState ( initialState ) ;
17
18
const ref = useRef ( state ) ;
18
19
You can’t perform that action at this time.
0 commit comments