Override
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-25 05:21:35 +01:00
parent 1a6bd44c05
commit 29d539ec32

View File

@@ -22,6 +22,21 @@ export type Extend<T extends readonly object[]> = (
: {} : {}
) )
export type Override<T extends readonly object[]> = (
T extends readonly [
infer Super,
infer Self,
...infer Rest extends readonly object[],
]
? Override<readonly [
Omit<Super, CommonKeys<Self, Super>> & Self,
...Rest,
]>
: T extends readonly [infer Self]
? Self
: {}
)
/** /**
* Merges an inheritance tree defined by an array of types without allowing overrides. * Merges an inheritance tree defined by an array of types without allowing overrides.
* @template T - An array of types representing the inheritance tree. * @template T - An array of types representing the inheritance tree.