Skip to content

Commit

Permalink
perf(type): improve Utilities in types.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe committed Jan 18, 2025
1 parent 502709f commit 85a3ecf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1984,9 +1984,9 @@ export type ExtractSchema<T> = UnionToIntersection<
T extends HonoBase<infer _, infer S, any> ? S : never
>

type EnvOrEmpty<T> = T extends Env ? (Env extends T ? {} : T) : T
type ProcessHead<T> = IfAnyThenEmptyObject<T extends Env ? (Env extends T ? {} : T) : T>
export type IntersectNonAnyTypes<T extends any[]> = T extends [infer Head, ...infer Rest]
? IfAnyThenEmptyObject<EnvOrEmpty<Head>> & IntersectNonAnyTypes<Rest>
? ProcessHead<Head> & IntersectNonAnyTypes<Rest>
: {}

////////////////////////////////////////
Expand Down

0 comments on commit 85a3ecf

Please sign in to comment.