From cd91be3d9fe84bee89514246b900cc28db58ab15 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sat, 18 Jan 2025 19:16:01 +0900 Subject: [PATCH] perf(type): improve Utilities in `types.ts` --- src/types.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/types.ts b/src/types.ts index bfa96a260..634af5d67 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1980,13 +1980,11 @@ export type RemoveQuestion = T extends `${infer R}?` ? R : T ////// ////// //////////////////////////////////////// -export type ExtractSchema = UnionToIntersection< - T extends HonoBase ? S : never -> +export type ExtractSchema = T extends HonoBase ? S : never -type EnvOrEmpty = T extends Env ? (Env extends T ? {} : T) : T +type ProcessHead = IfAnyThenEmptyObject export type IntersectNonAnyTypes = T extends [infer Head, ...infer Rest] - ? IfAnyThenEmptyObject> & IntersectNonAnyTypes + ? ProcessHead & IntersectNonAnyTypes : {} ////////////////////////////////////////