0.1.0 #1

Merged
Thilawyn merged 65 commits from next into master 2024-02-06 03:15:40 +01:00
3 changed files with 16 additions and 7 deletions
Showing only changes of commit 793d288d8b - Show all commits

View File

@@ -6,7 +6,7 @@ import pkg from "./package.json" assert { type: "json" }
export default defineConfig({ export default defineConfig({
input: "src/index.ts", input: "src/lib.ts",
output: [ output: [
{ {

View File

@@ -1,7 +1,14 @@
import { Call, Fn, Pipe, Tuples } from "hotscript" 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 { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "."
import { CommonKeys, ExtendFn, KeysOnlyInLeft, SimplifyFn, StaticMembersFn } from "./util" import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util"
type RemoveSupertraitsAbstractFromAbstract<Left, Right> = {
[Key in Extract<keyof Left, keyof Right>]: Left[Key]
} & {
[Key in Exclude<keyof Left, keyof Right>]: Left[Key]
}
export class TraitExpression< export class TraitExpression<
@@ -54,10 +61,7 @@ export class TraitExpression<
) { ) {
return new Trait( return new Trait(
this, this,
{} as Simplify< {} as RemoveSupertraitsAbstractFromAbstract<SubtraitAbstract, Implements<typeof this>>,
CommonKeys<SubtraitAbstract, Implements<typeof this>> &
KeysOnlyInLeft<SubtraitAbstract, Implements<typeof this>>
>,
apply as any as (Super: AbstractClass<{}>) => RemoveAbstractFromImplClass<SubtraitImplClassWithAbstract, SubtraitAbstract>, apply as any as (Super: AbstractClass<{}>) => RemoveAbstractFromImplClass<SubtraitImplClassWithAbstract, SubtraitAbstract>,
) )
} }

5
src/lib.ts Normal file
View File

@@ -0,0 +1,5 @@
export {
abstract, expression, trait,
type Trait,
type TraitExpression
} from "."