Switched branding to string litteral
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-06 22:33:47 +01:00
parent 2bfb770e05
commit b2b81d6134
3 changed files with 8 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ import { AbstractTag, TraitExpression, emptyTraitExpression } from "."
import { ExtendFn, SimplifyFn, StaticMembers, StaticMembersFn } from "./util"
export const isTraitApplierSuper = Symbol("isTraitApplierSuper")
export type TraitApplierSuperTag = "@thilawyn/traitify-ts/TraitApplierSuper"
export type AddAbstractToImplClass<
@@ -19,14 +19,14 @@ export type AddAbstractToImplClass<
)
export type RemoveAbstractFromImplClass<
ImplClassWithAbstract extends Class<Abstract, []> & { [isTraitApplierSuper]: true },
ImplClassWithAbstract extends Class<Abstract, []> & { _tag: TraitApplierSuperTag },
Abstract extends {},
> = (
Class<
Omit<InstanceType<ImplClassWithAbstract>, keyof Abstract>,
ConstructorParameters<ImplClassWithAbstract>
> &
Omit<StaticMembers<ImplClassWithAbstract>, typeof isTraitApplierSuper>
Omit<StaticMembers<ImplClassWithAbstract>, "_tag">
)
@@ -137,14 +137,12 @@ export namespace Trait {
}
export type TraitApplierSuperTag = "@thilawyn/traitify-ts/TraitApplierSuper"
export function trait<
Abstract extends {},
ImplClassWithAbstract extends Class<Abstract, []> & { [isTraitApplierSuper]: true },
ImplClassWithAbstract extends Class<Abstract, []> & { _tag: TraitApplierSuperTag },
>(
abstract: Opaque<Abstract, AbstractTag>,
apply: (Super: AbstractClass<Abstract> & { [isTraitApplierSuper]: true }) => ImplClassWithAbstract,
apply: (Super: AbstractClass<Abstract> & { _tag: TraitApplierSuperTag }) => ImplClassWithAbstract,
) {
return new Trait(
emptyTraitExpression,

View File

@@ -1,6 +1,6 @@
import { Call, Fn, Pipe, Tuples } from "hotscript"
import { AbstractClass, Class, Opaque } from "type-fest"
import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag, isTraitApplierSuper } from "."
import { AbstractTag, RemoveAbstractFromImplClass, Trait, TraitApplierSuperTag } from "."
import { ExtendFn, SimplifyFn, StaticMembersFn } from "./util"
@@ -53,11 +53,11 @@ export class TraitExpression<
subtrait<
This extends TraitExpression<typeof TraitExpression.NullSuperclass, any, any>,
SubtraitAbstract extends Implements<This>,
SubtraitImplClassWithAbstract extends Class<SubtraitAbstract, []> & { [isTraitApplierSuper]: true },
SubtraitImplClassWithAbstract extends Class<SubtraitAbstract, []> & { _tag: TraitApplierSuperTag },
>(
this: This,
abstract: (expression: This) => Opaque<SubtraitAbstract, AbstractTag>,
apply: (Super: AbstractClass<SubtraitAbstract> & { [isTraitApplierSuper]: true }) => SubtraitImplClassWithAbstract,
apply: (Super: AbstractClass<SubtraitAbstract> & { _tag: TraitApplierSuperTag }) => SubtraitImplClassWithAbstract,
) {
return new Trait(
this,

View File

@@ -5,5 +5,4 @@ export {
trait,
type Trait,
type TraitExpression,
isTraitApplierSuper,
} from "."