Skip to content

Commit 89cbea8

Browse files
authored
No this type arguments in base constraints (#54536)
1 parent e60cf12 commit 89cbea8

File tree

6 files changed

+192
-27
lines changed

6 files changed

+192
-27
lines changed

src/compiler/checker.ts

+15-19
Original file line numberDiff line numberDiff line change
@@ -12502,10 +12502,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1250212502
if (getObjectFlags(type) & ObjectFlags.Reference) {
1250312503
const target = (type as TypeReference).target;
1250412504
const typeArguments = getTypeArguments(type as TypeReference);
12505-
if (length(target.typeParameters) === length(typeArguments)) {
12506-
const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType!]));
12507-
return needApparentType ? getApparentType(ref) : ref;
12508-
}
12505+
return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType!])) : type;
1250912506
}
1251012507
else if (type.flags & TypeFlags.Intersection) {
1251112508
const types = sameMap((type as IntersectionType).types, t => getTypeWithThisArgument(t, thisArgument, needApparentType));
@@ -12514,10 +12511,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1251412511
return needApparentType ? getApparentType(type) : type;
1251512512
}
1251612513

12517-
function getThisArgument(type: Type) {
12518-
return getObjectFlags(type) & ObjectFlags.Reference && length(getTypeArguments(type as TypeReference)) > getTypeReferenceArity(type as TypeReference) ? last(getTypeArguments(type as TypeReference)) : type;
12519-
}
12520-
1252112514
function resolveObjectTypeMembers(type: ObjectType, source: InterfaceTypeWithDeclaredMembers, typeParameters: readonly TypeParameter[], typeArguments: readonly Type[]) {
1252212515
let mapper: TypeMapper | undefined;
1252312516
let members: SymbolTable;
@@ -13699,7 +13692,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1369913692
return type.resolvedBaseConstraint;
1370013693
}
1370113694
const stack: object[] = [];
13702-
return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
13695+
return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
1370313696

1370413697
function getImmediateBaseConstraint(t: Type): Type {
1370513698
if (!t.immediateBaseConstraint) {
@@ -13805,17 +13798,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1380513798
// We substitute constraints for variadic elements only when the constraints are array types or
1380613799
// non-variadic tuple types as we want to avoid further (possibly unbounded) recursion.
1380713800
const newElements = map(getElementTypes(t), (v, i) => {
13808-
const constraint = t.target.elementFlags[i] & ElementFlags.Variadic && getBaseConstraint(v) || v;
13809-
return constraint && everyType(constraint, c => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
13801+
const constraint = v.flags & TypeFlags.TypeParameter && t.target.elementFlags[i] & ElementFlags.Variadic && getBaseConstraint(v) || v;
13802+
return constraint !== v && everyType(constraint, c => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
1381013803
});
1381113804
return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
1381213805
}
1381313806
return t;
1381413807
}
1381513808
}
1381613809

13817-
function getApparentTypeOfIntersectionType(type: IntersectionType) {
13818-
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type, /*needApparentType*/ true));
13810+
function getApparentTypeOfIntersectionType(type: IntersectionType, thisArgument: Type) {
13811+
return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, thisArgument, /*needApparentType*/ true));
1381913812
}
1382013813

1382113814
function getResolvedTypeParameterDefault(typeParameter: TypeParameter): Type | undefined {
@@ -13893,9 +13886,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1389313886
* type itself.
1389413887
*/
1389513888
function getApparentType(type: Type): Type {
13896-
const t = !(type.flags & TypeFlags.Instantiable) ? type : getBaseConstraintOfType(type) || unknownType;
13897-
return getObjectFlags(t) & ObjectFlags.Mapped ? getApparentTypeOfMappedType(t as MappedType) :
13898-
t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(t as IntersectionType) :
13889+
const t = type.flags & TypeFlags.Instantiable ? getBaseConstraintOfType(type) || unknownType : type;
13890+
const objectFlags = getObjectFlags(t);
13891+
return objectFlags & ObjectFlags.Mapped ? getApparentTypeOfMappedType(t as MappedType) :
13892+
objectFlags & ObjectFlags.Reference && t !== type ? getTypeWithThisArgument(t, type) :
13893+
t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(t as IntersectionType, type) :
1389913894
t.flags & TypeFlags.StringLike ? globalStringType :
1390013895
t.flags & TypeFlags.NumberLike ? globalNumberType :
1390113896
t.flags & TypeFlags.BigIntLike ? getGlobalBigIntType() :
@@ -21623,9 +21618,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2162321618
}
2162421619
const c = target as ConditionalType;
2162521620
// We check for a relationship to a conditional type target only when the conditional type has no
21626-
// 'infer' positions and is not distributive or is distributive but doesn't reference the check type
21627-
// parameter in either of the result types.
21628-
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
21621+
// 'infer' positions, is not distributive or is distributive but doesn't reference the check type
21622+
// parameter in either of the result types, and the source isn't an instantiation of the same
21623+
// conditional type (as happens when computing variance).
21624+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source.flags & TypeFlags.Conditional && (source as ConditionalType).root === c.root)) {
2162921625
// Check if the conditional is always true or always false but still deferred for distribution purposes.
2163021626
const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
2163121627
const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));

tests/baselines/reference/complexRecursiveCollections.errors.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
immutable.ts(341,22): error TS2430: Interface 'Keyed<K, V>' incorrectly extends interface 'Collection<K, V>'.
22
The types returned by 'toSeq()' are incompatible between these types.
33
Type 'Keyed<K, V>' is not assignable to type 'this'.
4-
'this' could be instantiated with an arbitrary type which could be unrelated to 'Keyed<K, V>'.
4+
'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
55
immutable.ts(359,22): error TS2430: Interface 'Indexed<T>' incorrectly extends interface 'Collection<number, T>'.
66
The types returned by 'toSeq()' are incompatible between these types.
77
Type 'Indexed<T>' is not assignable to type 'this'.
8-
'this' could be instantiated with an arbitrary type which could be unrelated to 'Indexed<T>'.
8+
'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
99
immutable.ts(391,22): error TS2430: Interface 'Set<T>' incorrectly extends interface 'Collection<never, T>'.
1010
The types returned by 'toSeq()' are incompatible between these types.
1111
Type 'Set<T>' is not assignable to type 'this'.
12-
'this' could be instantiated with an arbitrary type which could be unrelated to 'Set<T>'.
12+
'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
1313

1414

1515
==== complex.ts (0 errors) ====
@@ -379,7 +379,7 @@ immutable.ts(391,22): error TS2430: Interface 'Set<T>' incorrectly extends inter
379379
!!! error TS2430: Interface 'Keyed<K, V>' incorrectly extends interface 'Collection<K, V>'.
380380
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
381381
!!! error TS2430: Type 'Keyed<K, V>' is not assignable to type 'this'.
382-
!!! error TS2430: 'this' could be instantiated with an arbitrary type which could be unrelated to 'Keyed<K, V>'.
382+
!!! error TS2430: 'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
383383
toJS(): Object;
384384
toJSON(): { [key: string]: V };
385385
toSeq(): Seq.Keyed<K, V>;
@@ -402,7 +402,7 @@ immutable.ts(391,22): error TS2430: Interface 'Set<T>' incorrectly extends inter
402402
!!! error TS2430: Interface 'Indexed<T>' incorrectly extends interface 'Collection<number, T>'.
403403
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
404404
!!! error TS2430: Type 'Indexed<T>' is not assignable to type 'this'.
405-
!!! error TS2430: 'this' could be instantiated with an arbitrary type which could be unrelated to 'Indexed<T>'.
405+
!!! error TS2430: 'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
406406
toJS(): Array<any>;
407407
toJSON(): Array<T>;
408408
// Reading values
@@ -439,7 +439,7 @@ immutable.ts(391,22): error TS2430: Interface 'Set<T>' incorrectly extends inter
439439
!!! error TS2430: Interface 'Set<T>' incorrectly extends interface 'Collection<never, T>'.
440440
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
441441
!!! error TS2430: Type 'Set<T>' is not assignable to type 'this'.
442-
!!! error TS2430: 'this' could be instantiated with an arbitrary type which could be unrelated to 'Set<T>'.
442+
!!! error TS2430: 'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
443443
toJS(): Array<any>;
444444
toJSON(): Array<T>;
445445
toSeq(): Seq.Set<T>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
//// [tests/cases/compiler/largeTupleTypes.ts] ////
2+
3+
=== largeTupleTypes.ts ===
4+
// Repro from #54491
5+
6+
type UnshiftTuple<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? Tail : never;
7+
>UnshiftTuple : Symbol(UnshiftTuple, Decl(largeTupleTypes.ts, 0, 0))
8+
>T : Symbol(T, Decl(largeTupleTypes.ts, 2, 18))
9+
>T : Symbol(T, Decl(largeTupleTypes.ts, 2, 18))
10+
>T : Symbol(T, Decl(largeTupleTypes.ts, 2, 18))
11+
>Tail : Symbol(Tail, Decl(largeTupleTypes.ts, 2, 67))
12+
>Tail : Symbol(Tail, Decl(largeTupleTypes.ts, 2, 67))
13+
14+
type ExpandSmallerTuples<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? T | ExpandSmallerTuples<Tail> : [];
15+
>ExpandSmallerTuples : Symbol(ExpandSmallerTuples, Decl(largeTupleTypes.ts, 2, 89))
16+
>T : Symbol(T, Decl(largeTupleTypes.ts, 3, 25))
17+
>T : Symbol(T, Decl(largeTupleTypes.ts, 3, 25))
18+
>T : Symbol(T, Decl(largeTupleTypes.ts, 3, 25))
19+
>Tail : Symbol(Tail, Decl(largeTupleTypes.ts, 3, 74))
20+
>T : Symbol(T, Decl(largeTupleTypes.ts, 3, 25))
21+
>ExpandSmallerTuples : Symbol(ExpandSmallerTuples, Decl(largeTupleTypes.ts, 2, 89))
22+
>Tail : Symbol(Tail, Decl(largeTupleTypes.ts, 3, 74))
23+
24+
type Shift<A extends Array<any>> = ((...args: A) => void) extends (...args: [A[0], ...infer R]) => void ? R : never;
25+
>Shift : Symbol(Shift, Decl(largeTupleTypes.ts, 3, 118))
26+
>A : Symbol(A, Decl(largeTupleTypes.ts, 4, 11))
27+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
28+
>args : Symbol(args, Decl(largeTupleTypes.ts, 4, 37))
29+
>A : Symbol(A, Decl(largeTupleTypes.ts, 4, 11))
30+
>args : Symbol(args, Decl(largeTupleTypes.ts, 4, 67))
31+
>A : Symbol(A, Decl(largeTupleTypes.ts, 4, 11))
32+
>R : Symbol(R, Decl(largeTupleTypes.ts, 4, 91))
33+
>R : Symbol(R, Decl(largeTupleTypes.ts, 4, 91))
34+
35+
type GrowExpRev<A extends Array<any>, N extends number, P extends Array<Array<any>>> = A['length'] extends N ? A : GrowExpRev<[...A, ...P[0]][N] extends undefined ? [...A, ...P[0]] : A, N, Shift<P>>;
36+
>GrowExpRev : Symbol(GrowExpRev, Decl(largeTupleTypes.ts, 4, 116))
37+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
38+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
39+
>N : Symbol(N, Decl(largeTupleTypes.ts, 5, 37))
40+
>P : Symbol(P, Decl(largeTupleTypes.ts, 5, 55))
41+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
42+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
43+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
44+
>N : Symbol(N, Decl(largeTupleTypes.ts, 5, 37))
45+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
46+
>GrowExpRev : Symbol(GrowExpRev, Decl(largeTupleTypes.ts, 4, 116))
47+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
48+
>P : Symbol(P, Decl(largeTupleTypes.ts, 5, 55))
49+
>N : Symbol(N, Decl(largeTupleTypes.ts, 5, 37))
50+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
51+
>P : Symbol(P, Decl(largeTupleTypes.ts, 5, 55))
52+
>A : Symbol(A, Decl(largeTupleTypes.ts, 5, 16))
53+
>N : Symbol(N, Decl(largeTupleTypes.ts, 5, 37))
54+
>Shift : Symbol(Shift, Decl(largeTupleTypes.ts, 3, 118))
55+
>P : Symbol(P, Decl(largeTupleTypes.ts, 5, 55))
56+
57+
type GrowExp<A extends Array<any>, N extends number, P extends Array<Array<any>>> = [...A, ...A][N] extends undefined ? GrowExp<[...A, ...A], N, [A, ...P]> : GrowExpRev<A, N, P>;
58+
>GrowExp : Symbol(GrowExp, Decl(largeTupleTypes.ts, 5, 199))
59+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
60+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
61+
>N : Symbol(N, Decl(largeTupleTypes.ts, 6, 34))
62+
>P : Symbol(P, Decl(largeTupleTypes.ts, 6, 52))
63+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
64+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
65+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
66+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
67+
>N : Symbol(N, Decl(largeTupleTypes.ts, 6, 34))
68+
>GrowExp : Symbol(GrowExp, Decl(largeTupleTypes.ts, 5, 199))
69+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
70+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
71+
>N : Symbol(N, Decl(largeTupleTypes.ts, 6, 34))
72+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
73+
>P : Symbol(P, Decl(largeTupleTypes.ts, 6, 52))
74+
>GrowExpRev : Symbol(GrowExpRev, Decl(largeTupleTypes.ts, 4, 116))
75+
>A : Symbol(A, Decl(largeTupleTypes.ts, 6, 13))
76+
>N : Symbol(N, Decl(largeTupleTypes.ts, 6, 34))
77+
>P : Symbol(P, Decl(largeTupleTypes.ts, 6, 52))
78+
79+
type Tuple<T, N extends number> = number extends N ? Array<T> : N extends 0 ? [] : N extends 1 ? [T] : GrowExp<[T], N, [[]]>;
80+
>Tuple : Symbol(Tuple, Decl(largeTupleTypes.ts, 6, 178))
81+
>T : Symbol(T, Decl(largeTupleTypes.ts, 7, 11))
82+
>N : Symbol(N, Decl(largeTupleTypes.ts, 7, 13))
83+
>N : Symbol(N, Decl(largeTupleTypes.ts, 7, 13))
84+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
85+
>T : Symbol(T, Decl(largeTupleTypes.ts, 7, 11))
86+
>N : Symbol(N, Decl(largeTupleTypes.ts, 7, 13))
87+
>N : Symbol(N, Decl(largeTupleTypes.ts, 7, 13))
88+
>T : Symbol(T, Decl(largeTupleTypes.ts, 7, 11))
89+
>GrowExp : Symbol(GrowExp, Decl(largeTupleTypes.ts, 5, 199))
90+
>T : Symbol(T, Decl(largeTupleTypes.ts, 7, 11))
91+
>N : Symbol(N, Decl(largeTupleTypes.ts, 7, 13))
92+
93+
declare class ArrayValidator<T extends unknown[], I = T[number]> {
94+
>ArrayValidator : Symbol(ArrayValidator, Decl(largeTupleTypes.ts, 7, 125))
95+
>T : Symbol(T, Decl(largeTupleTypes.ts, 9, 29))
96+
>I : Symbol(I, Decl(largeTupleTypes.ts, 9, 49))
97+
>T : Symbol(T, Decl(largeTupleTypes.ts, 9, 29))
98+
99+
lengthRange<S extends number, E extends number>(start: S, endBefore: E): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>>;
100+
>lengthRange : Symbol(ArrayValidator.lengthRange, Decl(largeTupleTypes.ts, 9, 66))
101+
>S : Symbol(S, Decl(largeTupleTypes.ts, 10, 16))
102+
>E : Symbol(E, Decl(largeTupleTypes.ts, 10, 33))
103+
>start : Symbol(start, Decl(largeTupleTypes.ts, 10, 52))
104+
>S : Symbol(S, Decl(largeTupleTypes.ts, 10, 16))
105+
>endBefore : Symbol(endBefore, Decl(largeTupleTypes.ts, 10, 61))
106+
>E : Symbol(E, Decl(largeTupleTypes.ts, 10, 33))
107+
>ArrayValidator : Symbol(ArrayValidator, Decl(largeTupleTypes.ts, 7, 125))
108+
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
109+
>ExpandSmallerTuples : Symbol(ExpandSmallerTuples, Decl(largeTupleTypes.ts, 2, 89))
110+
>UnshiftTuple : Symbol(UnshiftTuple, Decl(largeTupleTypes.ts, 0, 0))
111+
>Tuple : Symbol(Tuple, Decl(largeTupleTypes.ts, 6, 178))
112+
>I : Symbol(I, Decl(largeTupleTypes.ts, 9, 49))
113+
>E : Symbol(E, Decl(largeTupleTypes.ts, 10, 33))
114+
>ExpandSmallerTuples : Symbol(ExpandSmallerTuples, Decl(largeTupleTypes.ts, 2, 89))
115+
>UnshiftTuple : Symbol(UnshiftTuple, Decl(largeTupleTypes.ts, 0, 0))
116+
>Tuple : Symbol(Tuple, Decl(largeTupleTypes.ts, 6, 178))
117+
>I : Symbol(I, Decl(largeTupleTypes.ts, 9, 49))
118+
>S : Symbol(S, Decl(largeTupleTypes.ts, 10, 16))
119+
}
120+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//// [tests/cases/compiler/largeTupleTypes.ts] ////
2+
3+
=== largeTupleTypes.ts ===
4+
// Repro from #54491
5+
6+
type UnshiftTuple<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? Tail : never;
7+
>UnshiftTuple : UnshiftTuple<T>
8+
9+
type ExpandSmallerTuples<T extends [...any[]]> = T extends [T[0], ...infer Tail] ? T | ExpandSmallerTuples<Tail> : [];
10+
>ExpandSmallerTuples : ExpandSmallerTuples<T>
11+
12+
type Shift<A extends Array<any>> = ((...args: A) => void) extends (...args: [A[0], ...infer R]) => void ? R : never;
13+
>Shift : Shift<A>
14+
>args : A
15+
>args : [A[0], ...R]
16+
17+
type GrowExpRev<A extends Array<any>, N extends number, P extends Array<Array<any>>> = A['length'] extends N ? A : GrowExpRev<[...A, ...P[0]][N] extends undefined ? [...A, ...P[0]] : A, N, Shift<P>>;
18+
>GrowExpRev : GrowExpRev<A, N, P>
19+
20+
type GrowExp<A extends Array<any>, N extends number, P extends Array<Array<any>>> = [...A, ...A][N] extends undefined ? GrowExp<[...A, ...A], N, [A, ...P]> : GrowExpRev<A, N, P>;
21+
>GrowExp : GrowExp<A, N, P>
22+
23+
type Tuple<T, N extends number> = number extends N ? Array<T> : N extends 0 ? [] : N extends 1 ? [T] : GrowExp<[T], N, [[]]>;
24+
>Tuple : Tuple<T, N>
25+
26+
declare class ArrayValidator<T extends unknown[], I = T[number]> {
27+
>ArrayValidator : ArrayValidator<T, I>
28+
29+
lengthRange<S extends number, E extends number>(start: S, endBefore: E): ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>>;
30+
>lengthRange : <S extends number, E extends number>(start: S, endBefore: E) => ArrayValidator<Exclude<ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, E>]>>, ExpandSmallerTuples<UnshiftTuple<[...Tuple<I, S>]>>>>
31+
>start : S
32+
>endBefore : E
33+
}
34+

tests/baselines/reference/mergedDeclarations7.errors.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
22
The types returned by 'use()' are incompatible between these types.
33
Type 'PassportStatic' is not assignable to type 'this'.
4-
'this' could be instantiated with an arbitrary type which could be unrelated to 'PassportStatic'.
4+
'PassportStatic' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Passport'.
55

66

77
==== passport.d.ts (0 errors) ====
@@ -29,4 +29,4 @@ test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Pas
2929
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
3030
!!! error TS2322: The types returned by 'use()' are incompatible between these types.
3131
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'.
32-
!!! error TS2322: 'this' could be instantiated with an arbitrary type which could be unrelated to 'PassportStatic'.
32+
!!! error TS2322: 'PassportStatic' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Passport'.

0 commit comments

Comments
 (0)