Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/toolsets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export class StackOneToolSet {
const additionalHeaders = this.extractRecord(parsedParams, 'headers');
const extraHeaders = normalizeHeaders(additionalHeaders);
// defu merges extraHeaders into baseHeaders, both are already branded types
const actionHeaders = defu(extraHeaders, baseHeaders) as StackOneHeaders;
const actionHeaders = defu(extraHeaders, baseHeaders);
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the type assertion here will cause a type error. The defu function doesn't preserve TypeScript branded types, so the result will be inferred as Record<string, string> instead of StackOneHeaders. However, actionHeaders is passed to rpcAction() (lines 504, 512, 521) which expects StackOneHeaders | undefined according to the schema definition.

Instead of using a type assertion, consider validating the merged headers through the schema to properly maintain the branded type:

const actionHeaders = stackOneHeadersSchema.parse(defu(extraHeaders, baseHeaders));

This ensures type safety while avoiding unsafe type assertions.

Copilot uses AI. Check for mistakes.

const bodyPayload = this.extractRecord(parsedParams, 'body');
const rpcBody: JsonObject = bodyPayload ? { ...bodyPayload } : {};
Expand Down
Loading