diff --git a/src/TraitExpression.ts b/src/TraitExpression.ts index fd0d7ca..2f71cef 100644 --- a/src/TraitExpression.ts +++ b/src/TraitExpression.ts @@ -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 { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "." import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util" @@ -24,24 +24,22 @@ export class TraitExpression< get extends(): ( AbstractClass< - Pipe<[ - InstanceType, - ...Call, AllTraits>, - ], [ - ExtendFn, - SimplifyFn, + Pipe, // Map all the traits to the instance of their implementation class + Tuples.Prepend>, // 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 + SimplifyFn, // Make readable for IDEs ]>, ConstructorParameters > & - Pipe<[ - Superclass, - ...Call, AllTraits>, - ], [ - Tuples.Map, - ExtendFn, - SimplifyFn, + Pipe, // Map all the traits to their implementation class + Tuples.Prepend, // Add the superclass at the top of the list + Tuples.Map, // Map all the classes to an object containing their static members + ExtendFn, // Reduce to a single object that extends all the objects in the list + SimplifyFn, // Make readable for IDEs ]> ) { return this.allTraits.reduce(