0.1.2 #9

Merged
Thilawyn merged 8 commits from next into master 2024-01-27 23:40:19 +01:00
Showing only changes of commit 47907c67b7 - Show all commits

View File

@@ -18,9 +18,11 @@ export type Trait<
C extends AbstractClass<any> C extends AbstractClass<any>
> = Opaque< > = Opaque<
TraitApplier<C>, 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. * Represents the function signature for applying a trait to a parent class.
* @template C - The abstract class type. * @template C - The abstract class type.
@@ -28,7 +30,7 @@ export type Trait<
export type TraitApplier< export type TraitApplier<
C extends AbstractClass<any> C extends AbstractClass<any>
> = > =
(Parent: AbstractConstructor<object>) => C (Parent: Opaque<AbstractConstructor<object>, TraitApplierTag>) => Opaque<C, TraitApplierTag>
/** /**
* Returns the class type of a trait. * Returns the class type of a trait.
@@ -154,7 +156,7 @@ export function extendsAndExpresses<
) { ) {
return traits.reduce( return traits.reduce(
(previous, trait) => trait(previous), (previous, trait) => trait(previous),
extend, extend as Opaque<C, TraitApplierTag>,
) as ( ) as (
AbstractClass< AbstractClass<
InstanceType<C> & InstanceType<C> &