This commit is contained in:
@@ -18,9 +18,11 @@ export type Trait<
|
||||
C extends AbstractClass<any>
|
||||
> = Opaque<
|
||||
TraitApplier<C>,
|
||||
"thilatrait/Trait"
|
||||
"@thilawyn/thilatrait/Trait"
|
||||
>
|
||||
|
||||
export type TraitApplierTag = "@thilawyn/thilatrait/Trait"
|
||||
|
||||
/**
|
||||
* Represents the function signature for applying a trait to a parent class.
|
||||
* @template C - The abstract class type.
|
||||
@@ -28,7 +30,7 @@ export type Trait<
|
||||
export type TraitApplier<
|
||||
C extends AbstractClass<any>
|
||||
> =
|
||||
(Parent: AbstractConstructor<object>) => C
|
||||
(Parent: Opaque<AbstractConstructor<object>, TraitApplierTag>) => Opaque<C, TraitApplierTag>
|
||||
|
||||
/**
|
||||
* Returns the class type of a trait.
|
||||
@@ -154,7 +156,7 @@ export function extendsAndExpresses<
|
||||
) {
|
||||
return traits.reduce(
|
||||
(previous, trait) => trait(previous),
|
||||
extend,
|
||||
extend as Opaque<C, TraitApplierTag>,
|
||||
) as (
|
||||
AbstractClass<
|
||||
InstanceType<C> &
|
||||
|
||||
Reference in New Issue
Block a user