This commit is contained in:
@@ -9,10 +9,10 @@ export type CommonKeys<A, B> = Extract<keyof A, keyof B>
|
||||
* Merges an inheritance tree defined by an array of types, considering overrides.
|
||||
* @template T - An array of types representing the inheritance tree.
|
||||
*/
|
||||
export type MergeInheritanceTree<T extends readonly any[]> = (
|
||||
export type Extend<T extends readonly any[]> = (
|
||||
T extends [infer Super, infer Self, ...infer Rest]
|
||||
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
|
||||
? MergeInheritanceTree<[
|
||||
? Extend<[
|
||||
Omit<Super, CommonKeys<Self, Super>> & Self,
|
||||
...Rest,
|
||||
]>
|
||||
@@ -26,10 +26,10 @@ export type MergeInheritanceTree<T extends readonly any[]> = (
|
||||
* Merges an inheritance tree defined by an array of types without allowing overrides.
|
||||
* @template T - An array of types representing the inheritance tree.
|
||||
*/
|
||||
export type MergeInheritanceTreeWithoutOverriding<T extends readonly any[]> = (
|
||||
export type ExtendWithoutOverriding<T extends readonly any[]> = (
|
||||
T extends [infer Super, infer Self, ...infer Rest]
|
||||
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
|
||||
? MergeInheritanceTreeWithoutOverriding<[
|
||||
? ExtendWithoutOverriding<[
|
||||
Super & Self,
|
||||
...Rest,
|
||||
]>
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./class"
|
||||
export * from "./effect"
|
||||
export * from "./inheritance"
|
||||
export * from "./extend"
|
||||
export * from "./misc"
|
||||
|
||||
Reference in New Issue
Block a user