TraitExpressionBuilder bugfix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -33,7 +33,7 @@ export class TraitExpressionBuilder<
|
|||||||
return traits.flatMap(trait => [
|
return traits.flatMap(trait => [
|
||||||
...trait.superExpression.traits,
|
...trait.superExpression.traits,
|
||||||
trait,
|
trait,
|
||||||
]) as TraitExpressionBuilder.SpreadSupertraits<T>
|
]) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.SpreadSupertraits<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
static traitsUniq<
|
static traitsUniq<
|
||||||
@@ -49,7 +49,7 @@ export class TraitExpressionBuilder<
|
|||||||
>(
|
>(
|
||||||
traits: T
|
traits: T
|
||||||
) {
|
) {
|
||||||
return uniq(traits) as TraitExpressionBuilder.TraitsUniq<T>
|
return uniq(traits) as readonly Trait<any, any, any, any>[] as TraitExpressionBuilder.TraitsUniq<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,30 +142,30 @@ export class TraitExpressionBuilder<
|
|||||||
|
|
||||||
export namespace TraitExpressionBuilder {
|
export namespace TraitExpressionBuilder {
|
||||||
export type SpreadSupertraits<Traits> = (
|
export type SpreadSupertraits<Traits> = (
|
||||||
Traits extends [
|
Traits extends readonly [
|
||||||
infer El extends Trait<any, any, any, any>,
|
infer El extends Trait<any, any, any, any>,
|
||||||
...infer Rest,
|
...infer Rest,
|
||||||
]
|
]
|
||||||
? [
|
? readonly [
|
||||||
...Trait.Supertraits<El>,
|
...Trait.Supertraits<El>,
|
||||||
El,
|
El,
|
||||||
...SpreadSupertraits<Rest>,
|
...SpreadSupertraits<Rest>,
|
||||||
]
|
]
|
||||||
: []
|
: readonly []
|
||||||
)
|
)
|
||||||
|
|
||||||
export type TraitsUniq<Traits> = (
|
export type TraitsUniq<Traits> = (
|
||||||
Traits extends [
|
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>
|
? TraitsUniq<Rest>
|
||||||
: [...TraitsUniq<Rest>, El]
|
: readonly [...TraitsUniq<Rest>, El]
|
||||||
: []
|
: readonly []
|
||||||
)
|
)
|
||||||
type IsTraitInTupleFromRight<Traits, T> = (
|
type IsTraitInTupleFromRight<Traits, T> = (
|
||||||
Traits extends [...infer Rest, infer El]
|
Traits extends readonly [...infer Rest, infer El]
|
||||||
? IsEqual<El, T> extends true
|
? IsEqual<El, T> extends true
|
||||||
? true
|
? true
|
||||||
: IsTraitInTupleFromRight<Rest, T>
|
: IsTraitInTupleFromRight<Rest, T>
|
||||||
|
|||||||
Reference in New Issue
Block a user