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

View File

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

View File

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