Skip to content

Commit b058d33

Browse files
committed
docs(ai-chat): use the declared signature for chat.withClientData
The block read as a call expression with a type-literal body, which is not valid TypeScript and did not match the declaration form the neighbouring chat.withUIMessage section uses.
1 parent c5e0f9f commit b058d33

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

docs/ai-chat/reference.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,13 @@ Use this when you need [`InferChatUIMessage`](#inferchatuimessage) / typed `data
550550
Returns a [`ChatBuilder`](/ai-chat/types#chatbuilder) with a fixed client data schema. Managed-agent hooks and `run` get typed `clientData` without passing `clientDataSchema` in `.agent()` options. Custom agents parse `payload.metadata` on the initial payload and later input frames before passing it to user code.
551551

552552
```ts
553-
chat.withClientData<TSchema>({
553+
chat.withClientData<TSchema extends TaskSchema>(config: {
554554
schema: TSchema;
555555
reportErrorAt?: "turn-end" | "arrival";
556-
onValidationError?: (event: { error: unknown; payload: ChatTaskWirePayload }) => Promise<void> | void;
556+
onValidationError?: (event: {
557+
error: unknown;
558+
payload: ChatTaskWirePayload;
559+
}) => Promise<void> | void;
557560
}): ChatBuilder<UIMessage, TSchema>;
558561
```
559562

0 commit comments

Comments
 (0)