This commit is contained in:
@@ -21,7 +21,11 @@ import { CommonKeys } from "."
|
||||
|
||||
|
||||
export type Extend<T extends readonly object[]> = (
|
||||
T extends [infer Super, infer Self, ...infer Rest extends object[]]
|
||||
T extends [
|
||||
infer Super,
|
||||
infer Self,
|
||||
...infer Rest extends object[]
|
||||
]
|
||||
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
|
||||
? Extend<[
|
||||
Omit<Super, CommonKeys<Self, Super>> & Self,
|
||||
@@ -34,12 +38,22 @@ export type Extend<T extends readonly object[]> = (
|
||||
)
|
||||
|
||||
export type Extendable<T extends readonly object[]> = (
|
||||
T extends [infer Super, infer Self, ...infer Rest extends object[]]
|
||||
T extends [
|
||||
infer Super extends object,
|
||||
infer Self extends object,
|
||||
...infer Rest extends object[],
|
||||
]
|
||||
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
|
||||
? Extendable<[
|
||||
Omit<Super, CommonKeys<Self, Super>> & Self,
|
||||
Super & Self,
|
||||
...Rest,
|
||||
]>
|
||||
: false
|
||||
: true
|
||||
)
|
||||
|
||||
export type NonExtendableKeys<T extends readonly object[]> = (
|
||||
Extendable<T> extends false
|
||||
? {}
|
||||
: never
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user