Skip to content

Commit c087368

Browse files
committed
test(sdk): fix expectTypeOf assertion shape for createStartSessionAction
`expectTypeOf().parameter(0).extract<...>()` was producing a constraint type that didn't match the optional-fields shape of the actual params, breaking CI typecheck. Verify the typed `clientData` field directly via `Parameters<typeof start>[0]["clientData"]` against the agent's clientDataSchema-derived shape (and check it's strictly narrower than `unknown`). Same coverage, sound assertion.
1 parent 2b0c24d commit c087368

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

packages/trigger-sdk/src/v3/createStartSessionAction.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,11 @@ describe("chat.createStartSessionAction — types", () => {
120120
const start = chat.createStartSessionAction<typeof fakeChat>("fake-chat");
121121

122122
// The clientData field is typed off the agent's schema.
123-
expectTypeOf(start).parameter(0).toHaveProperty("clientData");
124-
expectTypeOf(start).parameter(0).extract<{ clientData?: any }>().toEqualTypeOf<{
125-
chatId: string;
126-
clientData?: { userId: string; plan: "free" | "pro" };
127-
triggerConfig?: any;
128-
metadata?: Record<string, unknown>;
129-
}>();
123+
expectTypeOf<Parameters<typeof start>[0]["clientData"]>().toEqualTypeOf<
124+
{ userId: string; plan: "free" | "pro" } | undefined
125+
>();
126+
// The agent's typed clientData is strictly narrower than `unknown`.
127+
expectTypeOf<Parameters<typeof start>[0]["clientData"]>().not.toEqualTypeOf<unknown>();
130128
});
131129

132130
it("defaults clientData to unknown when called without a generic", () => {

0 commit comments

Comments
 (0)