Skip to content

Commit 20720b9

Browse files
maxholmanclaude
andcommitted
fix: remove undefined union from optional header property types
The | undefined union on optional header properties broke the Command generic constraint (Record<string, string | number | boolean>). The hasQuestionToken (?) already expresses optionality. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 93a75f6 commit 20720b9

8 files changed

Lines changed: 9 additions & 15 deletions

File tree

__tests__/__snapshots__/nullables.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports[`header parameters 1`] = `
2323
export type UploadDataCommandHeader = {
2424
"content-type": "application/json" | "text/csv" | "application/xml";
2525
"content-length": number;
26-
"x-idempotency-key"?: string | undefined;
26+
"x-idempotency-key"?: string;
2727
};
2828
export type UploadDataCommandParams = {
2929
uploadId: string;

__tests__/fixtures/test1/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99
/** eslint-disable max-classes */

__tests__/fixtures/test1/enums.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99
export const nullableStatus = ["active", "paused", "cancelled"] as const;

__tests__/fixtures/test1/hono-valibot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99

__tests__/fixtures/test1/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99
import {

__tests__/fixtures/test1/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99
import type { Jsonifiable, Jsonify } from "type-fest";
@@ -217,7 +217,7 @@ export type LongRunningOperation =
217217
export type ImportBillingDataCommandHeader = {
218218
"content-type": "application/json" | "text/csv" | "application/xml";
219219
"content-length": number;
220-
"x-idempotency-key"?: string | undefined;
220+
"x-idempotency-key"?: string;
221221
};
222222
type ImportBillingDataCommandBodyApplicationOctetStream = NonNullable<
223223
RequestInit["body"]

__tests__/fixtures/test1/valibot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* WARN: Do not edit directly.
55
*
6-
* Generated on 2026-04-12T05:31:16.393Z
6+
* Generated on 2026-04-23T13:57:43.818Z
77
*
88
*/
99
import * as v from "valibot";

lib/process-document.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,7 @@ export async function processOpenApiDocument(
547547
},
548548
);
549549

550-
const resolvedType = hp.required
551-
? type.type
552-
: typeof type.type === "function"
553-
? type.type
554-
: type.type
555-
? Writers.unionType(`${type.type}`, "undefined")
556-
: undefined;
550+
const resolvedType = type.type;
557551

558552
return {
559553
...type,

0 commit comments

Comments
 (0)