diff --git a/src/TraitExpression.ts b/src/TraitExpression.ts index 179839a..ade1782 100644 --- a/src/TraitExpression.ts +++ b/src/TraitExpression.ts @@ -15,11 +15,12 @@ export class TraitExpression< get extends(): ( AbstractClass< + InstanceType & // Keep the instance of the superclass outside of any kind of type manipulation + // as it can accidentely remove abstract properties Simplify< - Extend<[ - InstanceType, - ...TraitTuple.MapImplInstance, - ]> + Extend< + TraitTuple.MapImplInstance + > >, ConstructorParameters @@ -140,11 +141,12 @@ export type TraitExpressionConcreteClass< export type TraitExpressionInstance< Exp extends TraitExpression[]> > = ( + InstanceType> & // Keep the instance of the superclass outside of any kind of type manipulation + // as it can accidentely remove abstract properties Simplify< - Extend<[ - InstanceType>, - ...TraitTuple.MapInstance>, - ]> + Extend< + TraitTuple.MapInstance> + > > ) diff --git a/src/tests.ts b/src/tests.ts index b7ada34..3725da4 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,4 +1,4 @@ -import { Simplify } from "type-fest" +import { AbstractClass, Simplify } from "type-fest" import { TraitClass } from "./Trait" import { trait } from "./TraitBuilder" import { Implements, ImplementsStatic, TraitExpressionClass } from "./TraitExpression" @@ -85,7 +85,17 @@ class User extends exp.extends implements Implements { console.log(new User()) -type T = NonExtendableKeys<[ - { prout: "gneugneu" }, - { prout: string }, -]> +abstract class Test { + abstract prout: string +} + +const MappedTest = Test as AbstractClass + +class ConcreteTest extends MappedTest { + +} + +// type T = NonExtendableKeys<[ +// { prout: "gneugneu" }, +// { prout: string }, +// ]>