Extendable
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Call, Fn, Tuples } from "hotscript"
|
||||
import { Call, ComposeLeft, Fn, Match, Tuples } from "hotscript"
|
||||
|
||||
|
||||
type CommonKeys<A, B> = Extract<keyof A, keyof B>
|
||||
@@ -14,3 +14,13 @@ interface ExtendReducerFn extends Fn {
|
||||
|
||||
export type ExtendFn = Tuples.Reduce<ExtendReducerFn, {}>
|
||||
export type Extend<T extends readonly object[]> = Call<ExtendFn, T>
|
||||
|
||||
|
||||
export type ExtendableFn = ComposeLeft<[
|
||||
ExtendFn,
|
||||
Match<[
|
||||
Match.With<never, false>,
|
||||
Match.With<any, true>,
|
||||
]>
|
||||
]>
|
||||
export type Extendable<T extends readonly object[]> = Call<ExtendableFn, T>
|
||||
|
||||
Reference in New Issue
Block a user