面试题答案
一键面试type DeepMap<T, U> = T extends object
? {
[K in keyof T]: DeepMap<T[K], U>;
}
: U;
type DeepObject = { a: string; b: { c: number; d: { e: boolean } } };
type Result = DeepMap<DeepObject, string>;
type DeepMap<T, U> = T extends object
? {
[K in keyof T]: DeepMap<T[K], U>;
}
: U;
type DeepObject = { a: string; b: { c: number; d: { e: boolean } } };
type Result = DeepMap<DeepObject, string>;