0.1.20 #20
@@ -36,7 +36,7 @@ export class TraitExpressionBuilder<
|
|||||||
]) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.SpreadSupertraits<T>
|
]) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.SpreadSupertraits<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
static traitsUniq<
|
static traitsUnique<
|
||||||
const T extends readonly Trait<
|
const T extends readonly Trait<
|
||||||
TraitExpression<
|
TraitExpression<
|
||||||
typeof TraitExpression.NullSuperclass,
|
typeof TraitExpression.NullSuperclass,
|
||||||
@@ -49,7 +49,7 @@ export class TraitExpressionBuilder<
|
|||||||
>(
|
>(
|
||||||
traits: T
|
traits: T
|
||||||
) {
|
) {
|
||||||
return unique(traits) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.TraitsUniq<T>
|
return unique(traits) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.TraitsUnique<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ export class TraitExpressionBuilder<
|
|||||||
return new this.constructor(
|
return new this.constructor(
|
||||||
this.expressionSuperclass,
|
this.expressionSuperclass,
|
||||||
|
|
||||||
this.constructor.traitsUniq([
|
this.constructor.traitsUnique([
|
||||||
...this.expressionTraits,
|
...this.expressionTraits,
|
||||||
...this.constructor.spreadSupertraits(traits),
|
...this.constructor.spreadSupertraits(traits),
|
||||||
]),
|
]),
|
||||||
@@ -109,7 +109,7 @@ export class TraitExpressionBuilder<
|
|||||||
return new this.constructor(
|
return new this.constructor(
|
||||||
this.expressionSuperclass,
|
this.expressionSuperclass,
|
||||||
|
|
||||||
this.constructor.traitsUniq([
|
this.constructor.traitsUnique([
|
||||||
...this.constructor.spreadSupertraits(traits),
|
...this.constructor.spreadSupertraits(traits),
|
||||||
...this.expressionTraits,
|
...this.expressionTraits,
|
||||||
]),
|
]),
|
||||||
@@ -154,14 +154,14 @@ export namespace TraitExpressionBuilder {
|
|||||||
: readonly []
|
: readonly []
|
||||||
)
|
)
|
||||||
|
|
||||||
export type TraitsUniq<Traits> = (
|
export type TraitsUnique<Traits> = (
|
||||||
Traits extends readonly [
|
Traits extends readonly [
|
||||||
...infer Rest,
|
...infer Rest,
|
||||||
infer El extends Trait<any, any, any, any>,
|
infer El extends Trait<any, any, any, any>,
|
||||||
]
|
]
|
||||||
? IsTraitInTupleFromRight<Rest, El> extends true
|
? IsTraitInTupleFromRight<Rest, El> extends true
|
||||||
? TraitsUniq<Rest>
|
? TraitsUnique<Rest>
|
||||||
: readonly [...TraitsUniq<Rest>, El]
|
: readonly [...TraitsUnique<Rest>, El]
|
||||||
: readonly []
|
: readonly []
|
||||||
)
|
)
|
||||||
type IsTraitInTupleFromRight<Traits, T> = (
|
type IsTraitInTupleFromRight<Traits, T> = (
|
||||||
@@ -176,7 +176,7 @@ export namespace TraitExpressionBuilder {
|
|||||||
Traits extends readonly Trait<any, any, any, any>[],
|
Traits extends readonly Trait<any, any, any, any>[],
|
||||||
T extends readonly Trait<any, any, any, any>[],
|
T extends readonly Trait<any, any, any, any>[],
|
||||||
> = (
|
> = (
|
||||||
TraitExpressionBuilder.TraitsUniq<readonly [
|
TraitExpressionBuilder.TraitsUnique<readonly [
|
||||||
...Traits,
|
...Traits,
|
||||||
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
||||||
]>
|
]>
|
||||||
@@ -186,7 +186,7 @@ export namespace TraitExpressionBuilder {
|
|||||||
Traits extends readonly Trait<any, any, any, any>[],
|
Traits extends readonly Trait<any, any, any, any>[],
|
||||||
T extends readonly Trait<any, any, any, any>[],
|
T extends readonly Trait<any, any, any, any>[],
|
||||||
> = (
|
> = (
|
||||||
TraitExpressionBuilder.TraitsUniq<readonly [
|
TraitExpressionBuilder.TraitsUnique<readonly [
|
||||||
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
...TraitExpressionBuilder.SpreadSupertraits<T>,
|
||||||
...Traits,
|
...Traits,
|
||||||
]>
|
]>
|
||||||
|
|||||||
Reference in New Issue
Block a user