From 793d288d8b2c62133a93cc54fc8a7bba7f9ebf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 5 Feb 2024 04:01:02 +0100 Subject: [PATCH] Working compilation --- rollup.config.ts | 2 +- src/TraitExpression.ts | 16 ++++++++++------ src/lib.ts | 5 +++++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 src/lib.ts 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 "."