Fixed static abstract apply
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-09 18:28:50 +01:00
parent 7191b35c7a
commit 3cf5733869
2 changed files with 7 additions and 5 deletions

View File

@@ -14,7 +14,9 @@ export type AddAbstractToImplClass<
StaticAbstract extends {},
> = (
Class<
Abstract & InstanceType<ImplClass>,
Abstract &
InstanceType<ImplClass>,
ConstructorParameters<ImplClass>
> &
StaticAbstract &
@@ -22,7 +24,7 @@ export type AddAbstractToImplClass<
)
export type RemoveAbstractFromImplClass<
ImplClassWithAbstract extends Class<Abstract, []> & { _tag: TraitApplierSuperTag },
ImplClassWithAbstract extends Class<Abstract, []> & StaticAbstract & { _tag: TraitApplierSuperTag },
Abstract extends {},
StaticAbstract extends {},
> = (
@@ -153,11 +155,11 @@ export namespace Trait {
export function trait<
Abstract extends {},
StaticAbstract extends {},
ImplClassWithAbstract extends Class<Abstract, []> & { _tag: TraitApplierSuperTag },
ImplClassWithAbstract extends Class<Abstract, []> & StaticAbstract & { _tag: TraitApplierSuperTag },
>(
abstract: Opaque<Abstract, AbstractTag>,
staticAbstract: Opaque<StaticAbstract, AbstractTag>,
apply: (Super: AbstractClass<Abstract> & { _tag: TraitApplierSuperTag }) => ImplClassWithAbstract,
apply: (Super: AbstractClass<Abstract> & StaticAbstract & { _tag: TraitApplierSuperTag }) => ImplClassWithAbstract,
) {
return new Trait(
emptyTraitExpression,

View File

@@ -55,7 +55,7 @@ export class TraitExpression<
This extends TraitExpression<typeof TraitExpression.NullSuperclass, any, any>,
SubtraitAbstract extends Implements<This>,
SubtraitStaticAbstract extends ImplementsStatic<This>,
SubtraitImplClassWithAbstract extends Class<SubtraitAbstract, []> & { _tag: TraitApplierSuperTag },
SubtraitImplClassWithAbstract extends Class<SubtraitAbstract, []> & SubtraitStaticAbstract & { _tag: TraitApplierSuperTag },
>(
this: This,
abstract: (expression: This) => Opaque<SubtraitAbstract, AbstractTag>,