Skip to content
Myr

fix(hc): allows optional schemas (#1608)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(hc): allows optional schemas * denoify

authored by Yusuke Wada · committed by GitHub · parent 0372214 · Browse files · 3 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−4 removed

  • tests:+2 added−2 removed
  • other:+2 added−2 removed

3 files+4 added−4 removed

modified:deno_dist/client/types.ts+1 added-1 removed
modified:src/client/client.test.ts+2 added-2 removed
5 unmodified lines
6import { setupServer } from 'msw/node'7import _fetch, { Request as NodeFetchRequest } from 'node-fetch'8import { vi } from 'vitest'9import { Hono } from '../hono'10import { parse, serialize } from '../utils/cookie'10import { parse } from '../utils/cookie'11import type { Equal, Expect } from '../utils/types'12import { validator } from '../validator'13import { hc } from './client'14import type { InferRequestOptionsType, InferRequestType, InferResponseType } from './types'14import type { InferRequestType, InferResponseType } from './types'1516// @ts-ignore17global.fetch = _fetch18// @ts-ignore
557 unmodified lines
modified:src/client/types.ts+1 added-1 removed
14 unmodified lines
15 }1617type ClientRequest<S extends Schema> = {18 [M in keyof S]: S[M] extends { input: infer R; output: infer O }19 ? RemoveBlankRecord<R> extends never19 ? RemoveBlankRecord<Required<R>> extends never20 ? (args?: {}, options?: ClientRequestOptions) => Promise<ClientResponse<O>>21 : (args: R, options?: ClientRequestOptions) => Promise<ClientResponse<O>>22 : never23} & {
90 unmodified lines