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

This commit is contained in:
Julien Valverdé
2024-02-05 04:01:02 +01:00
parent 6853bcbee8
commit 793d288d8b
3 changed files with 16 additions and 7 deletions

View File

@@ -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
View File

@@ -0,0 +1,5 @@
export {
abstract, expression, trait,
type Trait,
type TraitExpression
} from "."