mirror of
https://github.com/honojs/hono.git
synced 2024-11-24 19:26:56 +01:00
fix(types): rm ExcludeEmptyObject to fix massively increased type instantiations (#3507)
* fix: mv ExcludeEmptyObject to hono-base.ts * refactor: rm ExcludeEmptyObject
This commit is contained in:
parent
bd9effe34f
commit
331166471c
@ -1,4 +1,4 @@
|
||||
import type { app } from './generated/app'
|
||||
import { hc } from '../../src/client'
|
||||
import type { app } from './generated/app'
|
||||
|
||||
const client = hc<typeof app>('/')
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { Hono } from '../hono'
|
||||
import type { HonoBase } from '../hono-base'
|
||||
import type { Endpoint, ResponseFormat, Schema } from '../types'
|
||||
import type { StatusCode, SuccessStatusCode } from '../utils/http-status'
|
||||
import type { HasRequiredKeys } from '../utils/types'
|
||||
@ -159,7 +160,7 @@ type PathToChain<
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type Client<T> = T extends Hono<any, infer S, any>
|
||||
export type Client<T> = T extends HonoBase<any, infer S, any>
|
||||
? S extends Record<infer K, Schema>
|
||||
? K extends string
|
||||
? PathToChain<K, S>
|
||||
|
@ -26,7 +26,6 @@ import type {
|
||||
RouterRoute,
|
||||
Schema,
|
||||
} from './types'
|
||||
import type { ExcludeEmptyObject } from './utils/types'
|
||||
import { getPath, getPathNoStrict, mergePath } from './utils/url'
|
||||
|
||||
/**
|
||||
@ -213,11 +212,7 @@ class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string =
|
||||
>(
|
||||
path: SubPath,
|
||||
app: Hono<SubEnv, SubSchema, SubBasePath>
|
||||
): Hono<
|
||||
E,
|
||||
ExcludeEmptyObject<MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> | S>,
|
||||
BasePath
|
||||
> {
|
||||
): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> | S, BasePath> {
|
||||
const subApp = this.basePath(path)
|
||||
app.routes.map((r) => {
|
||||
let handler
|
||||
|
@ -97,5 +97,3 @@ export type IsAny<T> = boolean extends (T extends never ? true : false) ? true :
|
||||
* @see https://github.com/Microsoft/TypeScript/issues/29729
|
||||
*/
|
||||
export type StringLiteralUnion<T> = T | (string & Record<never, never>)
|
||||
|
||||
export type ExcludeEmptyObject<T> = T extends {} ? ({} extends T ? never : T) : T
|
||||
|
Loading…
Reference in New Issue
Block a user