Skip to content

Commit 8cc0530

Browse files
committed
hack the types to work a bit better with Response Unions
1 parent a7e4062 commit 8cc0530

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.changeset/olive-waves-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
hack the types to work a bit better with Response Unions

src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ export type CacheEntry = [number, any, Intent | undefined, Signal<number> & { co
222222

223223
export type NarrowResponse<T> = T extends CustomResponse<infer U> ? U : Exclude<T, Response>;
224224
export type RouterResponseInit = Omit<ResponseInit, "body"> & { revalidate?: string | string[] };
225-
export type CustomResponse<T> = Response & { customBody: () => T };
225+
// export type CustomResponse<T> = Response & { customBody: () => T };
226+
// hack to avoid it thinking it inherited from Response
227+
export type CustomResponse<T> = Omit<Response, "clone"> & { customBody: () => T; clone(...args: readonly unknown[]): CustomResponse<T> };
226228

227229
/** @deprecated */
228230
export type RouteLoadFunc = RoutePreloadFunc;

0 commit comments

Comments
 (0)