@@ -335,7 +335,7 @@ describe("generator", () => {
335335 | {
336336 [K in keyof TErrors]: {
337337 ok: false;
338- status: K extends string ? (K extends \`\${number}\` ? number : never) : never;
338+ status: K extends \`\${infer StatusCode extends number}\` ? StatusCode : never;
339339 error: TErrors[K];
340340 };
341341 }[keyof TErrors];
@@ -558,7 +558,7 @@ describe("generator", () => {
558558 api.get("/users").then((users) => console.log(users));
559559 api.post("/users", { body: { name: "John" } }).then((user) => console.log(user));
560560 api.put("/users/:id", { path: { id: 1 }, body: { name: "John" } }).then((user) => console.log(user));
561-
561+
562562 // With error handling
563563 const result = await api.get("/users/{id}", { withResponse: true }, { path: { id: "123" } });
564564 if (result.ok) {
@@ -920,7 +920,7 @@ describe("generator", () => {
920920 | {
921921 [K in keyof TErrors]: {
922922 ok: false;
923- status: K extends string ? (K extends \`\${number}\` ? number : never) : never;
923+ status: K extends \`\${infer StatusCode extends number}\` ? StatusCode : never;
924924 error: TErrors[K];
925925 };
926926 }[keyof TErrors];
@@ -1032,7 +1032,7 @@ describe("generator", () => {
10321032 api.get("/users").then((users) => console.log(users));
10331033 api.post("/users", { body: { name: "John" } }).then((user) => console.log(user));
10341034 api.put("/users/:id", { path: { id: 1 }, body: { name: "John" } }).then((user) => console.log(user));
1035-
1035+
10361036 // With error handling
10371037 const result = await api.get("/users/{id}", { withResponse: true }, { path: { id: "123" } });
10381038 if (result.ok) {
@@ -1192,7 +1192,7 @@ describe("generator", () => {
11921192 | {
11931193 [K in keyof TErrors]: {
11941194 ok: false;
1195- status: K extends string ? (K extends \`\${number}\` ? number : never) : never;
1195+ status: K extends \`\${infer StatusCode extends number}\` ? StatusCode : never;
11961196 error: TErrors[K];
11971197 };
11981198 }[keyof TErrors];
@@ -1304,7 +1304,7 @@ describe("generator", () => {
13041304 api.get("/users").then((users) => console.log(users));
13051305 api.post("/users", { body: { name: "John" } }).then((user) => console.log(user));
13061306 api.put("/users/:id", { path: { id: 1 }, body: { name: "John" } }).then((user) => console.log(user));
1307-
1307+
13081308 // With error handling
13091309 const result = await api.get("/users/{id}", { withResponse: true }, { path: { id: "123" } });
13101310 if (result.ok) {
@@ -1322,18 +1322,18 @@ describe("generator", () => {
13221322 test ( "error schemas" , async ( { expect } ) => {
13231323 const openApiDoc = ( await SwaggerParser . parse ( "./tests/samples/error-schemas.yaml" ) ) as OpenAPIObject ;
13241324 const generated = await prettify ( generateFile ( mapOpenApiEndpoints ( openApiDoc ) ) ) ;
1325-
1325+
13261326 // Verify error schemas are generated
13271327 expect ( generated ) . toContain ( "export type AuthError" ) ;
13281328 expect ( generated ) . toContain ( "export type NotFoundError" ) ;
13291329 expect ( generated ) . toContain ( "export type ValidationError" ) ;
13301330 expect ( generated ) . toContain ( "export type ForbiddenError" ) ;
13311331 expect ( generated ) . toContain ( "export type ServerError" ) ;
1332-
1332+
13331333 // Verify error responses are included in endpoint types
13341334 expect ( generated ) . toContain ( 'responses: { 200: Schemas.User; 401: Schemas.AuthError; 404: Schemas.NotFoundError; 500: Schemas.ServerError }' ) ;
13351335 expect ( generated ) . toContain ( 'responses: { 201: Schemas.Post; 400: Schemas.ValidationError; 403: Schemas.ForbiddenError }' ) ;
1336-
1336+
13371337 // Verify specific error schema structure
13381338 expect ( generated ) . toContain ( "error: string" ) ;
13391339 expect ( generated ) . toContain ( "code: number" ) ;
0 commit comments