面试题答案
一键面试type PolyMorphicTransform<T, U> = T extends Array<infer Item>
? Array<PolyMorphicTransform<Item, U>>
: T extends object
? {
[K in keyof T]: PolyMorphicTransform<T[K], U>;
}
: U;
type PolyMorphicTransform<T, U> = T extends Array<infer Item>
? Array<PolyMorphicTransform<Item, U>>
: T extends object
? {
[K in keyof T]: PolyMorphicTransform<T[K], U>;
}
: U;