This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Call, Fn, Pipe, Tuples } from "hotscript"
|
import { Fn, Pipe, Tuples } from "hotscript"
|
||||||
import { AbstractClass, Class, Opaque } from "type-fest"
|
import { AbstractClass, Class, Opaque } from "type-fest"
|
||||||
import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "."
|
import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "."
|
||||||
import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util"
|
import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util"
|
||||||
@@ -24,24 +24,22 @@ export class TraitExpression<
|
|||||||
|
|
||||||
get extends(): (
|
get extends(): (
|
||||||
AbstractClass<
|
AbstractClass<
|
||||||
Pipe<[
|
Pipe<AllTraits, [
|
||||||
InstanceType<Superclass>,
|
Tuples.Map<Trait.OwnImplInstanceFn>, // Map all the traits to the instance of their implementation class
|
||||||
...Call<Tuples.Map<Trait.OwnImplInstanceFn>, AllTraits>,
|
Tuples.Prepend<InstanceType<Superclass>>, // Add the instance of the superclass at the top of the list
|
||||||
], [
|
ExtendFn, // Reduce to a single instance that extends all the instances in the list
|
||||||
ExtendFn,
|
SimplifyFn, // Make readable for IDEs
|
||||||
SimplifyFn,
|
|
||||||
]>,
|
]>,
|
||||||
|
|
||||||
ConstructorParameters<Superclass>
|
ConstructorParameters<Superclass>
|
||||||
> &
|
> &
|
||||||
|
|
||||||
Pipe<[
|
Pipe<AllTraits, [
|
||||||
Superclass,
|
Tuples.Map<Trait.OwnImplClassFn>, // Map all the traits to their implementation class
|
||||||
...Call<Tuples.Map<Trait.OwnImplClassFn>, AllTraits>,
|
Tuples.Prepend<Superclass>, // Add the superclass at the top of the list
|
||||||
], [
|
Tuples.Map<StaticMembersFn>, // Map all the classes to an object containing their static members
|
||||||
Tuples.Map<StaticMembersFn>,
|
ExtendFn, // Reduce to a single object that extends all the objects in the list
|
||||||
ExtendFn,
|
SimplifyFn, // Make readable for IDEs
|
||||||
SimplifyFn,
|
|
||||||
]>
|
]>
|
||||||
) {
|
) {
|
||||||
return this.allTraits.reduce(
|
return this.allTraits.reduce(
|
||||||
|
|||||||
Reference in New Issue
Block a user