Skip to content

Commit 6b2c0cd

Browse files
rustyconoverclaude
andcommitted
codegen(ts): spread optional stream options so the registry type-checks under exactOptionalPropertyTypes
Matches the hand edit vgi-typescript made to src/generated/vgi-service.ts in 46c737e, so regenerating no longer reverts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d796a07 commit 6b2c0cd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎vgi/codegen/ts_registry.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,14 @@ def _render_default(tm: TsMethod) -> str:
355355
continue;
356356
}
357357
const stream = service[m.key] as VgiStream;
358+
// Optional members are spread in only when present, so the options bag
359+
// type-checks under exactOptionalPropertyTypes.
358360
const common = {
359361
params: m.params,
360362
outputSchema: stream.outputSchema,
361-
headerSchema: m.header ?? undefined,
362-
headerInit: stream.headerInit,
363-
onCancel: stream.onCancel,
363+
...(m.header ? { headerSchema: m.header } : {}),
364+
...(stream.headerInit ? { headerInit: stream.headerInit } : {}),
365+
...(stream.onCancel ? { onCancel: stream.onCancel } : {}),
364366
doc: m.doc,
365367
};
366368
if (stream.kind === "exchange") {

0 commit comments

Comments
 (0)