Skip to content

Commit ded56ea

Browse files
committed
responseGzipOrJson関数の型引数を追加し、より厳密な型チェックを実現
1 parent cf78fbd commit ded56ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { HttpResponse } from "msw";
1+
import { HttpResponse, JsonBodyType } from "msw";
22
import { gzipSync } from "zlib";
33

4-
export function responseGzipOrJson(response: any, url: URL) {
4+
export function responseGzipOrJson<T extends JsonBodyType>(response: T, url: URL) {
55
if (parseInt(url.searchParams.get("gzip") ?? "0") > 0) {
66
return HttpResponse.arrayBuffer(
77
gzipSync(Buffer.from(JSON.stringify(response)))

0 commit comments

Comments
 (0)