feat(core-extensions): Handle function type in MappedKeys

This commit is contained in:
T. R. Bernstein
2025-10-03 12:59:13 +02:00
parent 79d365b3d8
commit 8cc7db94df

View File

@@ -1,7 +1,9 @@
export type MappedKeys<T, R extends string> = T extends any[]
? { [K in keyof T]: MappedKeys<T[K], R> }
: T extends object
? {
[K in keyof T as R]: MappedKeys<T[K], R>
}
: T
export type MappedKeys<T, R extends string> = T extends Function
? T
: T extends Array<infer U>
? Array<MappedKeys<U, R>>
: T extends object
? {
[K in keyof T as R]: MappedKeys<T[K], R>
}
: T