Open History to see the last commit
1---
2id: UIMessage
3title: UIMessage
4---
5
6# Interface: UIMessage\<TData\>
7
8Defined in: [packages/typescript/ai/src/types.ts:423](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L423)
9
10UIMessage - Domain-specific message format optimized for building chat UIs
11Contains parts that can be text, tool calls, or tool results. Generic over
12the structured-output data type so `useChat({ outputSchema })`'s schema
13narrows `parts.find(p => p.type === 'structured-output').data` on the
14consumer side without manual casts.
15
16## Type Parameters
17
18### TData
19
20`TData` = `unknown`
21
22## Properties
23
24### createdAt?
25
26```ts
27optional createdAt: Date;
28```
29
30Defined in: [packages/typescript/ai/src/types.ts:427](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L427)
31
32***
33
34### id
35
36```ts
37id: string;
38```
39
40Defined in: [packages/typescript/ai/src/types.ts:424](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L424)
41
42***
43
44### parts
45
46```ts
47parts: MessagePart<TData>[];
48```
49
50Defined in: [packages/typescript/ai/src/types.ts:426](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L426)
51
52***
53
54### role
55
56```ts
57role: "user" | "assistant" | "system";
58```
59
60Defined in: [packages/typescript/ai/src/types.ts:425](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L425)