Pure TS implementation attempt
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,7 +12,21 @@ interface ExtendReducerFn extends Fn {
|
||||
}
|
||||
|
||||
export type ExtendFn = Tuples.Reduce<ExtendReducerFn, {}>
|
||||
export type Extend<T extends {}[]> = Call<ExtendFn, T>
|
||||
export type Extend<T extends readonly object[]> = Call<ExtendFn, T>
|
||||
|
||||
|
||||
export type ExtendPlain<T extends readonly any[]> = (
|
||||
T extends [infer Super, infer Self, ...infer Rest]
|
||||
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
|
||||
? ExtendPlain<[
|
||||
Omit<Super, CommonKeys<Self, Super>> & Self,
|
||||
...Rest,
|
||||
]>
|
||||
: never
|
||||
: T extends [infer Self]
|
||||
? Self
|
||||
: void
|
||||
)
|
||||
|
||||
|
||||
export type ExtendableFn = ComposeLeft<[
|
||||
@@ -22,4 +36,4 @@ export type ExtendableFn = ComposeLeft<[
|
||||
Match.With<any, true>,
|
||||
]>
|
||||
]>
|
||||
export type Extendable<T extends {}[]> = Call<ExtendableFn, T>
|
||||
export type Extendable<T extends object[]> = Call<ExtendableFn, T>
|
||||
|
||||
Reference in New Issue
Block a user