feat(core-extensions): Narrow type of array in mapKeys
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
export type MappedKeys<T, R extends string> =
|
||||
T extends Array<infer U>
|
||||
? Array<MappedKeys<U, R>>
|
||||
: T extends object
|
||||
? {
|
||||
[K in keyof T as R]: MappedKeys<T[K], R>
|
||||
}
|
||||
: T
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user