Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

isCustomEvent.md

33 lines604 Bytes

1---
2id: isCustomEvent
3title: isCustomEvent
4---
5​
6```ts
7function isCustomEvent<TName>(chunk, name): chunk is WellKnownCustomEvent<TName>;
8```
9​
10Defined in: packages/ai/src/custom-events.ts:102
11​
12Type guard: is `chunk` a CUSTOM event with the given well-known `name`?
13Narrows the payload type when true, so consumers read `chunk.value` typed.
14​
15## Type Parameters
16​
17### TName
18​
19`TName` *extends* [`WellKnownCustomEventName`](../type-aliases/WellKnownCustomEventName.md)
20​
21## Parameters
22​
23### chunk
24​
25[`AGUIEvent`](../type-aliases/AGUIEvent.md)
26​
27### name
28​
29`TName`
30​
31## Returns
32​
33`chunk is WellKnownCustomEvent<TName>`