Skip to content

Commit 4cf0b97

Browse files
Add type coverage for onError option wiring
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 677debc commit 4cf0b97

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/ai/src/chatTransport.types.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ it("accepts custom run store implementations via options typing", function () {
190190
expectTypeOf(transport).toBeObject();
191191
});
192192

193+
it("accepts custom onError callbacks via options typing", function () {
194+
const transport = new TriggerChatTransport({
195+
task: "ai-chat",
196+
accessToken: "pk_test",
197+
onError: function onError(error) {
198+
expectTypeOf(error.chatId).toEqualTypeOf<string>();
199+
expectTypeOf(error.runId).toEqualTypeOf<string>();
200+
},
201+
});
202+
203+
expectTypeOf(transport).toBeObject();
204+
});
205+
193206
it("exports typed header normalization helper", function () {
194207
const normalizedHeaders = normalizeTriggerChatHeaders({
195208
"x-header": "value",

0 commit comments

Comments
 (0)