fix(client): ignore `header` and `cookie` types (#1359)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix(client): ignore `header` and `cookie` types * denoify
authored by Yusuke Wada · committed by GitHub · parent 07bc29e · Browse files · 5 files·+33 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+33 added−11 removed
- tests:+12 added−0 removed
- other:+21 added−11 removed
Provenance
- Commit
2b27466- Tree
3f919ea- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
07bc29e
5 files changed+33 added−11 removed
modified:deno_dist/client/types.ts+5 added-1 removed
20 unmodified lines212223242525262728293031323366 unmodified lines20 unmodified linestype ClientRequest<S extends Data> = { [M in keyof S]: S[M] extends { input: infer R; output: infer O } ? RemoveBlankRecord<R> extends never ? (args?: {}, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : (args: R, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : ( // Client does not support `header` and `cookie` args: Omit<R, 'header' | 'cookie'>, options?: ClientRequestOptions ) => Promise<ClientResponse<O>> : never}
export interface ClientResponse<T> {66 unmodified linesmodified:deno_dist/types.ts+7 added-5 removed
96 unmodified lines97 O = {},98 I extends Input = {},99 I2 extends Input = I,100 I3 extends Input = I & I2,101- I4 extends Input = I2 & I3101+ I4 extends Input = I & I2 & I3102 >(103 ...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>]104 ): Hono<E, RemoveBlankRecord<S | Schema<M, P, I4['in'], O>>, BasePath>105 4 unmodified lines110 I extends Input = {},111 I2 extends Input = I,112 I3 extends Input = I & I2,113 I4 extends Input = I2 & I3,114- I5 extends Input = I3 & I4114+ I5 extends Input = I & I2 & I3 & I4115 >(116 ...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>, H<E, P, I5, O>]117 ): Hono<E, RemoveBlankRecord<S | Schema<M, P, I5['in'], O>>, BasePath>118 36 unmodified lines155 O = {},156 I extends Input = {},157 I2 extends Input = I,158 I3 extends Input = I & I2,159- I4 extends Input = I2 & I3159+ I4 extends Input = I & I2 & I3160 >(161 path: P,162 ...handlers: [163 H<E, MergePath<BasePath, P>, I, O>,10 unmodified lines174 I extends Input = {},175 I2 extends Input = I,176 I3 extends Input = I & I2,177 I4 extends Input = I2 & I3,178- I5 extends Input = I3 & I4178+ I5 extends Input = I & I2 & I3 & I4179 >(180 path: P,181 ...handlers: [182 H<E, MergePath<BasePath, P>, I, O>,246 unmodified lines429 ////// Utilities //////430 ////// //////431 ////////////////////////////////////////432 433-export type ExtractSchema<T> = UnionToIntersection<T extends Hono<infer _, infer S, any> ? S : never>433+export type ExtractSchema<T> = UnionToIntersection<434+ T extends Hono<infer _, infer S, any> ? S : never435+>436 437 ////////////////////////////////////////438 ////// //////439 ////// FetchEvent //////9 unmodified linesmodified:src/client/client.test.ts+12 added
23 unmodified lines24 25 const route = app26 .post(27 '/posts',28+ // Client does not support `cookie`29+ validator('cookie', () => {30+ return {} as {31+ debug: string32+ }33+ }),34+ // Client does not support `header`35+ validator('header', () => {36+ return {} as {37+ 'x-request-id': string38+ }39+ }),40 validator('json', () => {41 return {} as {42 id: number43 title: string404 unmodified linesmodified:src/client/types.ts+5 added-1 removed
20 unmodified lines212223242525262728293031323366 unmodified lines20 unmodified linestype ClientRequest<S extends Data> = { [M in keyof S]: S[M] extends { input: infer R; output: infer O } ? RemoveBlankRecord<R> extends never ? (args?: {}, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : (args: R, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : ( // Client does not support `header` and `cookie` args: Omit<R, 'header' | 'cookie'>, options?: ClientRequestOptions ) => Promise<ClientResponse<O>> : never}
export interface ClientResponse<T> {66 unmodified linesmodified:src/types.ts+4 added-4 removed
96 unmodified lines97 O = {},98 I extends Input = {},99 I2 extends Input = I,100 I3 extends Input = I & I2,101- I4 extends Input = I2 & I3101+ I4 extends Input = I & I2 & I3102 >(103 ...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>]104 ): Hono<E, RemoveBlankRecord<S | Schema<M, P, I4['in'], O>>, BasePath>105 4 unmodified lines110 I extends Input = {},111 I2 extends Input = I,112 I3 extends Input = I & I2,113 I4 extends Input = I2 & I3,114- I5 extends Input = I3 & I4114+ I5 extends Input = I & I2 & I3 & I4115 >(116 ...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>, H<E, P, I5, O>]117 ): Hono<E, RemoveBlankRecord<S | Schema<M, P, I5['in'], O>>, BasePath>118 36 unmodified lines155 O = {},156 I extends Input = {},157 I2 extends Input = I,158 I3 extends Input = I & I2,159- I4 extends Input = I2 & I3159+ I4 extends Input = I & I2 & I3160 >(161 path: P,162 ...handlers: [163 H<E, MergePath<BasePath, P>, I, O>,10 unmodified lines174 I extends Input = {},175 I2 extends Input = I,176 I3 extends Input = I & I2,177 I4 extends Input = I2 & I3,178- I5 extends Input = I3 & I4178+ I5 extends Input = I & I2 & I3 & I4179 >(180 path: P,181 ...handlers: [182 H<E, MergePath<BasePath, P>, I, O>,266 unmodified lines