Skip to content

Commit 5b19d05

Browse files
committedNov 1, 2022
fix(type): Aminadav#10 fix Type checking error
1 parent 992be42 commit 5b19d05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type UseStateRef = {
1313
<S = undefined>(): UseStateRefValue<S>;
1414
};
1515

16-
const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)): UseStateRefValue<S> => {
16+
const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)) => {
1717
const [state, setState] = useState(initialState);
1818
const ref = useRef(state);
1919

@@ -23,7 +23,7 @@ const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)): UseStateRefV
2323
setState(ref.current);
2424
}, []);
2525

26-
return [state, dispatch, ref];
26+
return [state, dispatch, ref] as UseStateRefValue<S>;
2727
};
2828

2929
export = useStateRef;

0 commit comments

Comments
 (0)
Please sign in to comment.