Extract the tool call type from a StateType's messages property. This is the primary way to specify tool call types when using useStream.
ExtractToolCallsFromState: StateType extends __type Messages extends readonly M[] ExtractToolCallFromMessageUnion<
M
> : Messages extends M[] ExtractToolCallFromMessageUnion<M> : never : never// Define state with typed messages
type MyToolCalls =
| { name: "get_weather"; args: { location: string }; id?: string }
| { name: "search"; args: { query: string }; id?: string };
interface MyState {
messages: Message<MyToolCalls>[];
}
// ExtractToolCallsFromState<MyState> = MyToolCalls