0.1.11 #11
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thilawyn/traitify-ts",
|
"name": "@thilawyn/traitify-ts",
|
||||||
"version": "0.1.10",
|
"version": "0.1.11",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://git.jvalver.de/api/packages/thilawyn/npm/"
|
"registry": "https://git.jvalver.de/api/packages/thilawyn/npm/"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"type-fest": "^4.10.2"
|
"type-fest": "^4.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Extend, StaticMembers } from "./util"
|
|||||||
export class Trait<
|
export class Trait<
|
||||||
SuperExpression extends TraitExpression<
|
SuperExpression extends TraitExpression<
|
||||||
typeof TraitExpression.NullSuperclass,
|
typeof TraitExpression.NullSuperclass,
|
||||||
Trait<any, any, any, any>[]
|
readonly Trait<any, any, any, any>[]
|
||||||
>,
|
>,
|
||||||
Abstract extends object,
|
Abstract extends object,
|
||||||
StaticAbstract extends object,
|
StaticAbstract extends object,
|
||||||
|
|||||||
@@ -6,44 +6,18 @@ import { Extend, StaticMembers } from "./util"
|
|||||||
|
|
||||||
declare const implSuperSymbol: unique symbol
|
declare const implSuperSymbol: unique symbol
|
||||||
|
|
||||||
type ImplSuper<This> = (
|
|
||||||
This extends TraitBuilder<
|
|
||||||
any,
|
|
||||||
infer Abstract,
|
|
||||||
infer StaticAbstract,
|
|
||||||
infer ImplClass
|
|
||||||
>
|
|
||||||
? (
|
|
||||||
AbstractClass<
|
|
||||||
Simplify<
|
|
||||||
Extend<[
|
|
||||||
Abstract,
|
|
||||||
InstanceType<ImplClass>,
|
|
||||||
]>
|
|
||||||
>
|
|
||||||
> &
|
|
||||||
|
|
||||||
Simplify<
|
|
||||||
Extend<[
|
|
||||||
StaticAbstract,
|
|
||||||
StaticMembers<ImplClass>,
|
|
||||||
]>
|
|
||||||
> &
|
|
||||||
{ readonly [implSuperSymbol]: true }
|
|
||||||
)
|
|
||||||
: never
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
export class TraitBuilder<
|
export class TraitBuilder<
|
||||||
SuperExpression extends TraitExpression<
|
SuperExpression extends TraitExpression<
|
||||||
typeof TraitExpression.NullSuperclass,
|
typeof TraitExpression.NullSuperclass,
|
||||||
Trait<any, any, any, any>[]
|
readonly Trait<any, any, any, any>[]
|
||||||
>,
|
>,
|
||||||
Abstract extends object,
|
Abstract extends object,
|
||||||
StaticAbstract extends object,
|
StaticAbstract extends object,
|
||||||
ImplClass extends AbstractClass<object, []>,
|
ImplClass extends AbstractClass<object, []>,
|
||||||
> {
|
> {
|
||||||
|
declare ["constructor"]: typeof TraitBuilder
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly traitSuperExpression: SuperExpression,
|
readonly traitSuperExpression: SuperExpression,
|
||||||
readonly traitAbstract: Abstract,
|
readonly traitAbstract: Abstract,
|
||||||
@@ -51,10 +25,11 @@ export class TraitBuilder<
|
|||||||
readonly traitApply: (Super: AbstractClass<object>) => ImplClass,
|
readonly traitApply: (Super: AbstractClass<object>) => ImplClass,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
abstract<A extends Abstract>(
|
abstract<A extends Abstract>(
|
||||||
_: (Super: AbstractClass<Abstract>) => AbstractClass<A, []>
|
_: (Super: AbstractClass<Abstract>) => AbstractClass<A, []>
|
||||||
) {
|
) {
|
||||||
return new TraitBuilder(
|
return new this.constructor(
|
||||||
this.traitSuperExpression,
|
this.traitSuperExpression,
|
||||||
{} as Simplify<A>,
|
{} as Simplify<A>,
|
||||||
this.traitStaticAbstract,
|
this.traitStaticAbstract,
|
||||||
@@ -65,7 +40,7 @@ export class TraitBuilder<
|
|||||||
staticAbstract<A extends StaticAbstract>(
|
staticAbstract<A extends StaticAbstract>(
|
||||||
_: (Super: AbstractClass<StaticAbstract>) => AbstractClass<A, []>
|
_: (Super: AbstractClass<StaticAbstract>) => AbstractClass<A, []>
|
||||||
) {
|
) {
|
||||||
return new TraitBuilder(
|
return new this.constructor(
|
||||||
this.traitSuperExpression,
|
this.traitSuperExpression,
|
||||||
this.traitAbstract,
|
this.traitAbstract,
|
||||||
{} as Simplify<A>,
|
{} as Simplify<A>,
|
||||||
@@ -74,11 +49,11 @@ export class TraitBuilder<
|
|||||||
}
|
}
|
||||||
|
|
||||||
implement<
|
implement<
|
||||||
ImplClassWithAbstract extends ImplSuper<typeof this> // TODO: find a way to set the constraint to concrete classes while keeping the Super arg as an abstract class
|
ImplClassWithAbstract extends TraitBuilder.ImplSuper<typeof this> // TODO: find a way to set the constraint to concrete classes while keeping the Super arg as an abstract class
|
||||||
>(
|
>(
|
||||||
apply: (Super: ImplSuper<typeof this>) => ImplClassWithAbstract
|
apply: (Super: TraitBuilder.ImplSuper<typeof this>) => ImplClassWithAbstract
|
||||||
) {
|
) {
|
||||||
return new TraitBuilder(
|
return new this.constructor(
|
||||||
this.traitSuperExpression,
|
this.traitSuperExpression,
|
||||||
this.traitAbstract,
|
this.traitAbstract,
|
||||||
this.traitStaticAbstract,
|
this.traitStaticAbstract,
|
||||||
@@ -103,6 +78,7 @@ export class TraitBuilder<
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
return new Trait(
|
return new Trait(
|
||||||
this.traitSuperExpression,
|
this.traitSuperExpression,
|
||||||
@@ -113,6 +89,37 @@ export class TraitBuilder<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace TraitBuilder {
|
||||||
|
export type ImplSuper<This> = (
|
||||||
|
This extends TraitBuilder<
|
||||||
|
any,
|
||||||
|
infer Abstract,
|
||||||
|
infer StaticAbstract,
|
||||||
|
infer ImplClass
|
||||||
|
>
|
||||||
|
? (
|
||||||
|
AbstractClass<
|
||||||
|
Simplify<
|
||||||
|
Extend<[
|
||||||
|
Abstract,
|
||||||
|
InstanceType<ImplClass>,
|
||||||
|
]>
|
||||||
|
>
|
||||||
|
> &
|
||||||
|
|
||||||
|
Simplify<
|
||||||
|
Extend<[
|
||||||
|
StaticAbstract,
|
||||||
|
StaticMembers<ImplClass>,
|
||||||
|
]>
|
||||||
|
> &
|
||||||
|
{ readonly [implSuperSymbol]: true }
|
||||||
|
)
|
||||||
|
: never
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const trait = new TraitBuilder(
|
export const trait = new TraitBuilder(
|
||||||
new TraitExpression(TraitExpression.NullSuperclass, []),
|
new TraitExpression(TraitExpression.NullSuperclass, []),
|
||||||
{} as object,
|
{} as object,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Extend, StaticMembers } from "./util"
|
|||||||
|
|
||||||
export class TraitExpression<
|
export class TraitExpression<
|
||||||
Superclass extends AbstractClass<object>,
|
Superclass extends AbstractClass<object>,
|
||||||
const Traits extends Trait<any, any, any, any>[],
|
const Traits extends readonly Trait<any, any, any, any>[],
|
||||||
> {
|
> {
|
||||||
constructor(
|
constructor(
|
||||||
readonly superclass: Superclass,
|
readonly superclass: Superclass,
|
||||||
@@ -95,7 +95,7 @@ export namespace TraitExpression {
|
|||||||
|
|
||||||
|
|
||||||
export type Implements<
|
export type Implements<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
Simplify<
|
Simplify<
|
||||||
Extend<
|
Extend<
|
||||||
@@ -107,7 +107,7 @@ export type Implements<
|
|||||||
)
|
)
|
||||||
|
|
||||||
export type StaticImplements<
|
export type StaticImplements<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
Simplify<
|
Simplify<
|
||||||
Extend<
|
Extend<
|
||||||
@@ -120,7 +120,7 @@ export type StaticImplements<
|
|||||||
|
|
||||||
|
|
||||||
export type TraitExpressionClass<
|
export type TraitExpressionClass<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
AbstractClass<
|
AbstractClass<
|
||||||
TraitExpressionInstance<Exp>,
|
TraitExpressionInstance<Exp>,
|
||||||
@@ -130,7 +130,7 @@ export type TraitExpressionClass<
|
|||||||
)
|
)
|
||||||
|
|
||||||
export type TraitExpressionConcreteClass<
|
export type TraitExpressionConcreteClass<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
Class<
|
Class<
|
||||||
TraitExpressionInstance<Exp>,
|
TraitExpressionInstance<Exp>,
|
||||||
@@ -140,7 +140,7 @@ export type TraitExpressionConcreteClass<
|
|||||||
)
|
)
|
||||||
|
|
||||||
export type TraitExpressionInstance<
|
export type TraitExpressionInstance<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
InstanceType<TraitExpression.Superclass<Exp>> & // Keep the instance of the superclass outside of any kind of type manipulation
|
InstanceType<TraitExpression.Superclass<Exp>> & // Keep the instance of the superclass outside of any kind of type manipulation
|
||||||
// as it can accidentely remove abstract properties
|
// as it can accidentely remove abstract properties
|
||||||
@@ -152,7 +152,7 @@ export type TraitExpressionInstance<
|
|||||||
)
|
)
|
||||||
|
|
||||||
export type TraitExpressionStaticMembers<
|
export type TraitExpressionStaticMembers<
|
||||||
Exp extends TraitExpression<any, Trait<any, any, any, any>[]>
|
Exp extends TraitExpression<any, readonly Trait<any, any, any, any>[]>
|
||||||
> = (
|
> = (
|
||||||
Simplify<
|
Simplify<
|
||||||
Extend<[
|
Extend<[
|
||||||
|
|||||||
@@ -5,85 +5,70 @@ import { TraitExpression } from "./TraitExpression"
|
|||||||
import { Extendable, StaticMembers } from "./util"
|
import { Extendable, StaticMembers } from "./util"
|
||||||
|
|
||||||
|
|
||||||
type SpreadSupertraits<Traits> = (
|
|
||||||
Traits extends [
|
|
||||||
infer El extends Trait<any, any, any, any>,
|
|
||||||
...infer Rest,
|
|
||||||
]
|
|
||||||
? [
|
|
||||||
...Trait.Supertraits<El>,
|
|
||||||
El,
|
|
||||||
...SpreadSupertraits<Rest>,
|
|
||||||
]
|
|
||||||
: []
|
|
||||||
)
|
|
||||||
|
|
||||||
type TraitsUniq<Traits> = (
|
|
||||||
Traits extends [
|
|
||||||
...infer Rest,
|
|
||||||
infer El extends Trait<any, any, any, any>,
|
|
||||||
]
|
|
||||||
? IsTraitInTupleFromRight<Rest, El> extends true
|
|
||||||
? TraitsUniq<Rest>
|
|
||||||
: [...TraitsUniq<Rest>, El]
|
|
||||||
: []
|
|
||||||
)
|
|
||||||
type IsTraitInTupleFromRight<Traits, T> = (
|
|
||||||
Traits extends [...infer Rest, infer El]
|
|
||||||
? IsEqual<El, T> extends true
|
|
||||||
? true
|
|
||||||
: IsTraitInTupleFromRight<Rest, T>
|
|
||||||
: false
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type BuildTraitExpression<
|
|
||||||
Superclass extends AbstractClass<object>,
|
|
||||||
Traits extends Trait<any, any, any, any>[],
|
|
||||||
> = (
|
|
||||||
Extendable<TraitTuple.MapAbstract<Traits>> extends false
|
|
||||||
? "Type conflict between the traits abstract definitions."
|
|
||||||
: Extendable<TraitTuple.MapStaticAbstract<Traits>> extends false
|
|
||||||
? "Type conflict between the traits static abstract definitions."
|
|
||||||
: Extendable<[
|
|
||||||
InstanceType<Superclass>,
|
|
||||||
...TraitTuple.MapImplInstance<Traits>,
|
|
||||||
]> extends false
|
|
||||||
? "Type conflict between the traits implementation instance and/or the superclass instance."
|
|
||||||
: Extendable<[
|
|
||||||
StaticMembers<Superclass>,
|
|
||||||
...TraitTuple.MapImplStaticMembers<Traits>,
|
|
||||||
]> extends false
|
|
||||||
? "Type conflict between the traits implementation static members and/or the superclass static members."
|
|
||||||
: TraitExpression<Superclass, Traits>
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
export class TraitExpressionBuilder<
|
export class TraitExpressionBuilder<
|
||||||
Superclass extends AbstractClass<object>,
|
Superclass extends AbstractClass<object>,
|
||||||
const Traits extends Trait<any, any, any, any>[],
|
const Traits extends readonly Trait<any, any, any, any>[],
|
||||||
> {
|
> {
|
||||||
|
declare ["constructor"]: typeof TraitExpressionBuilder
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly expressionSuperclass: Superclass,
|
readonly expressionSuperclass: Superclass,
|
||||||
readonly expressionTraits: Traits,
|
readonly expressionTraits: Traits,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
|
static spreadSupertraits<
|
||||||
|
const T extends readonly Trait<
|
||||||
|
TraitExpression<
|
||||||
|
typeof TraitExpression.NullSuperclass,
|
||||||
|
readonly Trait<any, any, any, any>[]
|
||||||
|
>,
|
||||||
|
any,
|
||||||
|
any,
|
||||||
|
any
|
||||||
|
>[]
|
||||||
|
>(
|
||||||
|
traits: T
|
||||||
|
) {
|
||||||
|
return traits.flatMap(trait => [
|
||||||
|
...trait.superExpression.traits,
|
||||||
|
trait,
|
||||||
|
]) as TraitExpressionBuilder.SpreadSupertraits<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
static traitsUniq<
|
||||||
|
const T extends readonly Trait<
|
||||||
|
TraitExpression<
|
||||||
|
typeof TraitExpression.NullSuperclass,
|
||||||
|
readonly Trait<any, any, any, any>[]
|
||||||
|
>,
|
||||||
|
any,
|
||||||
|
any,
|
||||||
|
any
|
||||||
|
>[]
|
||||||
|
>(
|
||||||
|
traits: T
|
||||||
|
) {
|
||||||
|
return uniq(traits) as TraitExpressionBuilder.TraitsUniq<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extends<
|
extends<
|
||||||
Super extends AbstractClass<object>
|
Super extends AbstractClass<object>
|
||||||
>(
|
>(
|
||||||
superclass: Super
|
superclass: Super
|
||||||
) {
|
) {
|
||||||
return new TraitExpressionBuilder(
|
return new this.constructor(
|
||||||
superclass,
|
superclass,
|
||||||
this.expressionTraits,
|
this.expressionTraits,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
expresses<
|
expresses<
|
||||||
const T extends Trait<
|
const T extends readonly Trait<
|
||||||
TraitExpression<
|
TraitExpression<
|
||||||
typeof TraitExpression.NullSuperclass,
|
typeof TraitExpression.NullSuperclass,
|
||||||
Trait<any, any, any, any>[]
|
readonly Trait<any, any, any, any>[]
|
||||||
>,
|
>,
|
||||||
any,
|
any,
|
||||||
any,
|
any,
|
||||||
@@ -91,25 +76,25 @@ export class TraitExpressionBuilder<
|
|||||||
>[]
|
>[]
|
||||||
>(
|
>(
|
||||||
...traits: T
|
...traits: T
|
||||||
) {
|
): TraitExpressionBuilder<
|
||||||
return new TraitExpressionBuilder(
|
Superclass,
|
||||||
|
TraitExpressionBuilder.ExpressesReturnTypeTraits<Traits, T>
|
||||||
|
> {
|
||||||
|
return new this.constructor(
|
||||||
this.expressionSuperclass,
|
this.expressionSuperclass,
|
||||||
|
|
||||||
uniq([
|
this.constructor.traitsUniq([
|
||||||
...this.expressionTraits,
|
...this.expressionTraits,
|
||||||
...traits.flatMap(trait => [
|
...this.constructor.spreadSupertraits(traits),
|
||||||
...trait.superExpression.traits,
|
]),
|
||||||
trait,
|
|
||||||
]),
|
|
||||||
]) as TraitsUniq<[...Traits, ...SpreadSupertraits<T>]>,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
expressesFirst<
|
expressesFirst<
|
||||||
const T extends Trait<
|
const T extends readonly Trait<
|
||||||
TraitExpression<
|
TraitExpression<
|
||||||
typeof TraitExpression.NullSuperclass,
|
typeof TraitExpression.NullSuperclass,
|
||||||
Trait<any, any, any, any>[]
|
readonly Trait<any, any, any, any>[]
|
||||||
>,
|
>,
|
||||||
any,
|
any,
|
||||||
any,
|
any,
|
||||||
@@ -117,25 +102,26 @@ export class TraitExpressionBuilder<
|
|||||||
>[]
|
>[]
|
||||||
>(
|
>(
|
||||||
...traits: T
|
...traits: T
|
||||||
) {
|
): TraitExpressionBuilder<
|
||||||
return new TraitExpressionBuilder(
|
Superclass,
|
||||||
|
TraitExpressionBuilder.ExpressesFirstReturnTypeTraits<Traits, T>
|
||||||
|
> {
|
||||||
|
return new this.constructor(
|
||||||
this.expressionSuperclass,
|
this.expressionSuperclass,
|
||||||
|
|
||||||
uniq([
|
this.constructor.traitsUniq([
|
||||||
...traits.flatMap(trait => [
|
...this.constructor.spreadSupertraits(traits),
|
||||||
...trait.superExpression.traits,
|
|
||||||
trait,
|
|
||||||
]),
|
|
||||||
...this.expressionTraits,
|
...this.expressionTraits,
|
||||||
]) as TraitsUniq<[...SpreadSupertraits<T>, ...Traits]>,
|
]),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
return new TraitExpression(
|
return new TraitExpression(
|
||||||
this.expressionSuperclass,
|
this.expressionSuperclass,
|
||||||
this.expressionTraits,
|
this.expressionTraits,
|
||||||
) as BuildTraitExpression<Superclass, Traits>
|
) as TraitExpressionBuilder.BuildTraitExpression<Superclass, Traits>
|
||||||
}
|
}
|
||||||
|
|
||||||
then<V>(fn: (expression: ReturnType<typeof this.build>) => V): V {
|
then<V>(fn: (expression: ReturnType<typeof this.build>) => V): V {
|
||||||
@@ -154,4 +140,79 @@ export class TraitExpressionBuilder<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace TraitExpressionBuilder {
|
||||||
|
export type SpreadSupertraits<Traits> = (
|
||||||
|
Traits extends [
|
||||||
|
infer El extends Trait<any, any, any, any>,
|
||||||
|
...infer Rest,
|
||||||
|
]
|
||||||
|
? [
|
||||||
|
...Trait.Supertraits<El>,
|
||||||
|
El,
|
||||||
|
...SpreadSupertraits<Rest>,
|
||||||
|
]
|
||||||
|
: []
|
||||||
|
)
|
||||||
|
|
||||||
|
export type TraitsUniq<Traits> = (
|
||||||
|
Traits extends [
|
||||||
|
...infer Rest,
|
||||||
|
infer El extends Trait<any, any, any, any>,
|
||||||
|
]
|
||||||
|
? IsTraitInTupleFromRight<Rest, El> extends true
|
||||||
|
? TraitsUniq<Rest>
|
||||||
|
: [...TraitsUniq<Rest>, El]
|
||||||
|
: []
|
||||||
|
)
|
||||||
|
type IsTraitInTupleFromRight<Traits, T> = (
|
||||||
|
Traits extends [...infer Rest, infer El]
|
||||||
|
? IsEqual<El, T> extends true
|
||||||
|
? true
|
||||||
|
: IsTraitInTupleFromRight<Rest, T>
|
||||||
|
: false
|
||||||
|
)
|
||||||
|
|
||||||
|
export type ExpressesReturnTypeTraits<
|
||||||
|
Traits extends readonly Trait<any, any, any, any>[],
|
||||||
|
T extends readonly Trait<any, any, any, any>[],
|
||||||
|
> = (
|
||||||
|
TraitExpressionBuilder.TraitsUniq<[
|
||||||
|
...Traits,
|
||||||
|
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
||||||
|
]>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type ExpressesFirstReturnTypeTraits<
|
||||||
|
Traits extends readonly Trait<any, any, any, any>[],
|
||||||
|
T extends readonly Trait<any, any, any, any>[],
|
||||||
|
> = (
|
||||||
|
TraitExpressionBuilder.TraitsUniq<[
|
||||||
|
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
||||||
|
...Traits,
|
||||||
|
]>
|
||||||
|
)
|
||||||
|
|
||||||
|
export type BuildTraitExpression<
|
||||||
|
Superclass extends AbstractClass<object>,
|
||||||
|
Traits extends readonly Trait<any, any, any, any>[],
|
||||||
|
> = (
|
||||||
|
Extendable<TraitTuple.MapAbstract<Traits>> extends false
|
||||||
|
? "Type conflict between the traits abstract definitions."
|
||||||
|
: Extendable<TraitTuple.MapStaticAbstract<Traits>> extends false
|
||||||
|
? "Type conflict between the traits static abstract definitions."
|
||||||
|
: Extendable<[
|
||||||
|
InstanceType<Superclass>,
|
||||||
|
...TraitTuple.MapImplInstance<Traits>,
|
||||||
|
]> extends false
|
||||||
|
? "Type conflict between the traits implementation instance and/or the superclass instance."
|
||||||
|
: Extendable<[
|
||||||
|
StaticMembers<Superclass>,
|
||||||
|
...TraitTuple.MapImplStaticMembers<Traits>,
|
||||||
|
]> extends false
|
||||||
|
? "Type conflict between the traits implementation static members and/or the superclass static members."
|
||||||
|
: TraitExpression<Superclass, Traits>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const expression = new TraitExpressionBuilder(TraitExpression.NullSuperclass, [])
|
export const expression = new TraitExpressionBuilder(TraitExpression.NullSuperclass, [])
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const exp = expression
|
|||||||
PrintsHelloOnNew,
|
PrintsHelloOnNew,
|
||||||
Identifiable<bigint>(),
|
Identifiable<bigint>(),
|
||||||
// Identifiable<number>(),
|
// Identifiable<number>(),
|
||||||
|
// StatefulSubscription,
|
||||||
ActiveStatefulSubscription,
|
ActiveStatefulSubscription,
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
Reference in New Issue
Block a user