Erased stream handle useful as a parameter type for helpers and
wrapper components that pass a stream through to selector hooks
(useMessages, useChannel, …) without reading values directly.
Any fully-typed UseStreamReturn<T, I, C> is assignable to
AnyStream. Widening the three generic slots to any is not
enough on its own: members whose types are computed from T in
covariant positions don't collapse to a top type under any. In
particular toolCalls: InferToolCalls<any>[] resolves to
AssembledToolCall<string, …, never>[] — the never output slot is
narrower than a concrete handle's AssembledToolCall<…, unknown>[],
so the concrete handle fails to assign and every useToolCalls(stream)
call would need an as AnyStream cast. values / ~stateType
(computed via InferStateType<any>) have the same hazard. We override
those members with their widest forms so the erased handle is a true
supertype of every concrete UseStreamReturn.
AnyStream: Omit<UseStreamReturn<any, any, any>, "toolCalls" | "values" | "~stateType"> __typefunction SubgraphCard({ stream, subgraph }: {
stream: AnyStream;
subgraph: SubgraphDiscoverySnapshot;
}) {
const messages = useMessages(stream, subgraph);
return <Feed messages={messages} />;
}