diff --git a/rollup.config.ts b/rollup.config.ts index bca2cda..22d5101 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -6,7 +6,7 @@ import pkg from "./package.json" assert { type: "json" } export default defineConfig({ - input: "src/index.ts", + input: "src/lib.ts", output: [ { diff --git a/src/TraitExpression.ts b/src/TraitExpression.ts index 4c66717..6f02ec7 100644 --- a/src/TraitExpression.ts +++ b/src/TraitExpression.ts @@ -1,7 +1,14 @@ import { Call, Fn, Pipe, Tuples } from "hotscript" -import { AbstractClass, Class, Opaque, Simplify } from "type-fest" +import { AbstractClass, Class, Opaque } from "type-fest" import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "." -import { CommonKeys, ExtendFn, KeysOnlyInLeft, SimplifyFn, StaticMembersFn } from "./util" +import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util" + + +type RemoveSupertraitsAbstractFromAbstract = { + [Key in Extract]: Left[Key] +} & { + [Key in Exclude]: Left[Key] +} export class TraitExpression< @@ -54,10 +61,7 @@ export class TraitExpression< ) { return new Trait( this, - {} as Simplify< - CommonKeys> & - KeysOnlyInLeft> - >, + {} as RemoveSupertraitsAbstractFromAbstract>, apply as any as (Super: AbstractClass<{}>) => RemoveAbstractFromImplClass, ) } diff --git a/src/lib.ts b/src/lib.ts new file mode 100644 index 0000000..c929b01 --- /dev/null +++ b/src/lib.ts @@ -0,0 +1,5 @@ +export { + abstract, expression, trait, + type Trait, + type TraitExpression +} from "."