`useStore` hook doesn't respect `ReactFlowState` generic
Author: aidenfoxxCreated Jul 18, 2024Updated Jul 8, 2026
Labelsenhancementtopic:typescriptnext major
What platform were you using when you found the bug?
- React Flow / Svelte Flow version: V12
- Browser and version: N/A
- OS and version: N/A
Live code example
No response
Describe the Bug
The useStore hook throws a type error when adding a node definition to the ReactFlowState parameter.
Steps to reproduce the bug or issue
// error: Argument of type '(state: ReactFlowState<AppNode>) => string[]' is not assignable to parameter of type '(state: ReactFlowState) => string[]'.
const inputNames = useStore((state: ReactFlowState<AppNode>) => {
// My code
}, isEqual);Expected behavior
The type is accepted, and the state is returned with the associated type.
Screenshots or Videos
No response
Additional context
No response
Source: xyflow/xyflow