Open History to see the last commit
1---
2id: parseWithStandardSchema
3title: parseWithStandardSchema
4---
5
6# Function: parseWithStandardSchema()
7
8```ts
9function parseWithStandardSchema<T>(schema, data): T;
10```
11
12Defined in: [packages/ai/src/activities/chat/tools/schema-converter.ts:443](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/tools/schema-converter.ts#L443)
13
14Synchronously validates data against a Standard Schema compliant schema.
15Note: Some Standard Schema implementations may only support async validation.
16In those cases, this function will throw.
17
18## Type Parameters
19
20### T
21
22`T`
23
24## Parameters
25
26### schema
27
28`unknown`
29
30Standard Schema compliant schema
31
32### data
33
34`unknown`
35
36Data to validate
37
38## Returns
39
40`T`
41
42Parsed/validated data
43
44## Throws
45
46StandardSchemaValidationError if validation fails; Error if the
47 schema only supports async validation.