Skip to content

Commit 1b967da

Browse files
Add type test for MethodResponse
1 parent 3f827ae commit 1b967da

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/openapi-fetch/test/index.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { HttpResponse, type StrictResponse } from "msw";
22
import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
33
import createClient, {
4+
type MethodResponse,
45
type Middleware,
56
type MiddlewareCallbackParams,
67
type QuerySerializerOptions,
@@ -132,6 +133,7 @@ describe("client", () => {
132133
created_at: number;
133134
updated_at: number;
134135
}>();
136+
expectTypeOf(result.data).toEqualTypeOf<MethodResponse<typeof client, 'get', '/mismatched-errors'>>();
135137
} else {
136138
expectTypeOf(result.data).toBeUndefined();
137139
expectTypeOf(result.error).extract<{ code: number }>().toEqualTypeOf<{ code: number; message: string }>();

0 commit comments

Comments
 (0)