This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import { Call, Fn, Pipe, Tuples } from "hotscript"
|
||||
import { AbstractClass, Class, Opaque, Simplify } from "type-fest"
|
||||
import { AbstractClass, Class, Opaque } from "type-fest"
|
||||
import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "."
|
||||
import { CommonKeys, ExtendFn, KeysOnlyInLeft, SimplifyFn, StaticMembersFn } from "./util"
|
||||
import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util"
|
||||
|
||||
|
||||
type RemoveSupertraitsAbstractFromAbstract<Left, Right> = {
|
||||
[Key in Extract<keyof Left, keyof Right>]: Left[Key]
|
||||
} & {
|
||||
[Key in Exclude<keyof Left, keyof Right>]: Left[Key]
|
||||
}
|
||||
|
||||
|
||||
export class TraitExpression<
|
||||
@@ -54,10 +61,7 @@ export class TraitExpression<
|
||||
) {
|
||||
return new Trait(
|
||||
this,
|
||||
{} as Simplify<
|
||||
CommonKeys<SubtraitAbstract, Implements<typeof this>> &
|
||||
KeysOnlyInLeft<SubtraitAbstract, Implements<typeof this>>
|
||||
>,
|
||||
{} as RemoveSupertraitsAbstractFromAbstract<SubtraitAbstract, Implements<typeof this>>,
|
||||
apply as any as (Super: AbstractClass<{}>) => RemoveAbstractFromImplClass<SubtraitImplClassWithAbstract, SubtraitAbstract>,
|
||||
)
|
||||
}
|
||||
|
||||
5
src/lib.ts
Normal file
5
src/lib.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export {
|
||||
abstract, expression, trait,
|
||||
type Trait,
|
||||
type TraitExpression
|
||||
} from "."
|
||||
Reference in New Issue
Block a user