From 7f83b44a577c46f7b45e94b16e4e52ff8cb3ec85 Mon Sep 17 00:00:00 2001 From: wo-o29 Date: Mon, 25 Aug 2025 22:09:40 +0900 Subject: [PATCH] docs: add explicit reducer function type annotation in useReducer --- src/content/learn/typescript.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/learn/typescript.md b/src/content/learn/typescript.md index 7822f3623..5d0c19fcd 100644 --- a/src/content/learn/typescript.md +++ b/src/content/learn/typescript.md @@ -236,7 +236,9 @@ import { stateReducer, State } from './your-reducer-implementation'; const initialState = { count: 0 }; export default function App() { - const [state, dispatch] = useReducer(stateReducer, initialState); + const [state, dispatch] = useReducer< + (state: State, action: CounterAction) => State + >(stateReducer, initialState); } ```