TraitExpression subtrait work
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-02-14 03:27:03 +01:00
parent 14ceae27ec
commit 5873926dc5

View File

@@ -52,22 +52,11 @@ export class TraitExpression<
implementsStatic(target: ImplementsStatic<typeof this>, context: any) {} implementsStatic(target: ImplementsStatic<typeof this>, context: any) {}
subtrait< subtrait<
This extends TraitExpression<typeof TraitExpression.NullSuperclass, any, any>, This extends TraitExpression<typeof TraitExpression.NullSuperclass, any, any>
SubtraitAbstract extends Implements<This>,
SubtraitStaticAbstract extends ImplementsStatic<This>,
SubtraitImplClassWithAbstract extends Class<SubtraitAbstract, []> & SubtraitStaticAbstract & { _tag: TraitApplierSuperTag },
>( >(
this: This, this: This
abstract: (expression: This) => Opaque<SubtraitAbstract, AbstractTag>,
staticAbstract: (expression: This) => Opaque<SubtraitStaticAbstract, AbstractTag>,
apply: (Super: AbstractClass<SubtraitAbstract> & SubtraitStaticAbstract & { _tag: TraitApplierSuperTag }) => SubtraitImplClassWithAbstract,
) { ) {
return new Trait( return new Trait(
this,
// {} as RemoveSupertraitsAbstractFromAbstract<SubtraitAbstract, Implements<typeof this>>,
{} as SubtraitAbstract, // TODO: find a way to cleanly substract Implements<typeof this> from this.
{} as SubtraitStaticAbstract, // TODO: find a way to cleanly substract StaticImplements<typeof this> from this.
apply as any as (Super: AbstractClass<{}>) => RemoveAbstractFromImplClass<SubtraitImplClassWithAbstract, SubtraitAbstract, SubtraitStaticAbstract>,
) )
} }
} }