Skip to content

Commit

Permalink
#60881 Minor typo change
Browse files Browse the repository at this point in the history
  • Loading branch information
NamHaiBui committed Feb 7, 2025
1 parent 09022f3 commit 8def683
Show file tree
Hide file tree
Showing 29 changed files with 127 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8448,7 +8448,7 @@
"category": "Error",
"code": 18057
},
"'{1}' is constrained to be a subtype of'{0}'.": {
"'{1}' is constrained to be a subtype of '{0}'.": {
"category": "Error",
"code": 18058
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base
'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'.
assignmentCompatWithCallSignatures4.ts(58,9): error TS2322: Type '(...x: Base[]) => Base' is not assignable to type '<T extends Derived>(...x: T[]) => T'.
Type 'Base' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Base'.
'T' is constrained to be a subtype of 'Base'.
assignmentCompatWithCallSignatures4.ts(62,9): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '<T extends Derived>(x: T, y: T) => T'.
Type 'Base' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Base'.
'T' is constrained to be a subtype of 'Base'.
assignmentCompatWithCallSignatures4.ts(66,9): error TS2322: Type '(x: Base[], y: Derived2[]) => Derived[]' is not assignable to type '<T extends Array<Derived2>>(x: Base[], y: Base[]) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Derived[]'.
'T' is constrained to be a subtype of 'Derived[]'.
assignmentCompatWithCallSignatures4.ts(69,9): error TS2322: Type '<T>(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => number'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'.
Expand Down Expand Up @@ -149,23 +149,23 @@ assignmentCompatWithCallSignatures4.ts(96,9): error TS2322: Type '<T>(x: T) => s
~~~
!!! error TS2322: Type '(...x: Base[]) => Base' is not assignable to type '<T extends Derived>(...x: T[]) => T'.
!!! error TS2322: Type 'Base' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Base'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Base'.

var b11: <T extends Derived>(x: T, y: T) => T;
a11 = b11;
b11 = a11;
~~~
!!! error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '<T extends Derived>(x: T, y: T) => T'.
!!! error TS2322: Type 'Base' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Base'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Base'.

var b12: <T extends Array<Derived2>>(x: Array<Base>, y: Array<Base>) => T;
a12 = b12;
b12 = a12;
~~~
!!! error TS2322: Type '(x: Base[], y: Derived2[]) => Derived[]' is not assignable to type '<T extends Array<Derived2>>(x: Base[], y: Base[]) => T'.
!!! error TS2322: Type 'Derived[]' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Derived[]'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Derived[]'.

var b15: <T>(x: { a: T; b: T }) => T;
a15 = b15;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (
'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'.
assignmentCompatWithConstructSignatures4.ts(58,9): error TS2322: Type 'new (...x: Base[]) => Base' is not assignable to type 'new <T extends Derived>(...x: T[]) => T'.
Type 'Base' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Base'.
'T' is constrained to be a subtype of 'Base'.
assignmentCompatWithConstructSignatures4.ts(62,9): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new <T extends Derived>(x: T, y: T) => T'.
Type 'Base' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Base'.
'T' is constrained to be a subtype of 'Base'.
assignmentCompatWithConstructSignatures4.ts(66,9): error TS2322: Type 'new (x: Base[], y: Derived2[]) => Derived[]' is not assignable to type 'new <T extends Array<Derived2>>(x: Base[], y: Base[]) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'T' is constrained to be a subtype of'Derived[]'.
'T' is constrained to be a subtype of 'Derived[]'.
assignmentCompatWithConstructSignatures4.ts(69,9): error TS2322: Type 'new <T>(x: { a: T; b: T; }) => T' is not assignable to type 'new (x: { a: string; b: number; }) => number'.
Types of parameters 'x' and 'x' are incompatible.
Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'.
Expand Down Expand Up @@ -165,23 +165,23 @@ assignmentCompatWithConstructSignatures4.ts(96,9): error TS2322: Type 'new <T>(x
~~~
!!! error TS2322: Type 'new (...x: Base[]) => Base' is not assignable to type 'new <T extends Derived>(...x: T[]) => T'.
!!! error TS2322: Type 'Base' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Base'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Base'.

var b11: new <T extends Derived>(x: T, y: T) => T;
a11 = b11; // ok
b11 = a11; // ok
~~~
!!! error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new <T extends Derived>(x: T, y: T) => T'.
!!! error TS2322: Type 'Base' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Base'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Base'.

var b12: new <T extends Array<Derived2>>(x: Array<Base>, y: Array<Base>) => T;
a12 = b12; // ok
b12 = a12; // ok
~~~
!!! error TS2322: Type 'new (x: Base[], y: Derived2[]) => Derived[]' is not assignable to type 'new <T extends Array<Derived2>>(x: Base[], y: Base[]) => T'.
!!! error TS2322: Type 'Derived[]' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'Derived[]'.
!!! error TS2322: 'T' is constrained to be a subtype of 'Derived[]'.

var b15: new <T>(x: { a: T; b: T }) => T;
a15 = b15; // ok
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/awaitedTypeNoLib.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ awaitedTypeNoLib.ts(18,27): error TS2345: Argument of type 'NotPromise<TResult>
Type 'TResult | (TResult extends PromiseLike<unknown> ? never : TResult)' is not assignable to type 'Thenable<TResult>'.
Type 'Thenable<unknown> & TResult' is not assignable to type 'Thenable<TResult>'.
Type 'unknown' is not assignable to type 'TResult'.
'TResult' is constrained to be a subtype of'unknown'.
'TResult' is constrained to be a subtype of 'unknown'.


!!! error TS2318: Cannot find global type 'Array'.
Expand Down Expand Up @@ -52,7 +52,7 @@ awaitedTypeNoLib.ts(18,27): error TS2345: Argument of type 'NotPromise<TResult>
!!! error TS2345: Type 'TResult | (TResult extends PromiseLike<unknown> ? never : TResult)' is not assignable to type 'Thenable<TResult>'.
!!! error TS2345: Type 'Thenable<unknown> & TResult' is not assignable to type 'Thenable<TResult>'.
!!! error TS2345: Type 'unknown' is not assignable to type 'TResult'.
!!! error TS2345: 'TResult' is constrained to be a subtype of'unknown'.
!!! error TS2345: 'TResult' is constrained to be a subtype of 'unknown'.
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
better_subType_assignable_to_superType_error_messsage.ts(13,3): error TS2322: Type 'SuperType' is not assignable to type 'SubType2'.
'SubType2' is constrained to be a subtype of'SuperType'.
'SubType2' is constrained to be a subtype of 'SuperType'.


==== better_subType_assignable_to_superType_error_messsage.ts (1 errors) ====
Expand All @@ -18,7 +18,7 @@ better_subType_assignable_to_superType_error_messsage.ts(13,3): error TS2322: Ty
subType2 = superType;
~~~~~~~~
!!! error TS2322: Type 'SuperType' is not assignable to type 'SubType2'.
!!! error TS2322: 'SubType2' is constrained to be a subtype of'SuperType'.
!!! error TS2322: 'SubType2' is constrained to be a subtype of 'SuperType'.
!!! related TS2208 better_subType_assignable_to_superType_error_messsage.ts:1:41: This type parameter might need an `extends SubType2` constraint.
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,49): error TS2322: Type 'T' is not assignable to type 'S'.
'S' is constrained to be a subtype of'T'.
'S' is constrained to be a subtype of 'T'.
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,35): error TS2322: Type 'T' is not assignable to type 'S'.
'S' is constrained to be a subtype of'T'.
'S' is constrained to be a subtype of 'T'.
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'.
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'.
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'.
Expand All @@ -17,15 +17,15 @@ chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS
(new Chain(t)).then(tt => s).then(ss => t);
~
!!! error TS2322: Type 'T' is not assignable to type 'S'.
!!! error TS2322: 'S' is constrained to be a subtype of'T'.
!!! error TS2322: 'S' is constrained to be a subtype of 'T'.
!!! related TS2208 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:1:13: This type parameter might need an `extends S` constraint.
!!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature.

// But error to try to climb up the chain
(new Chain(s)).then(ss => t);
~
!!! error TS2322: Type 'T' is not assignable to type 'S'.
!!! error TS2322: 'S' is constrained to be a subtype of'T'.
!!! error TS2322: 'S' is constrained to be a subtype of 'T'.
!!! related TS2208 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:1:13: This type parameter might need an `extends S` constraint.
!!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature.

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/conditionalTypes1.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ conditionalTypes1.ts(29,5): error TS2322: Type 'T["x"]' is not assignable to typ
Type 'string | undefined' is not assignable to type '{}'.
Type 'undefined' is not assignable to type '{}'.
conditionalTypes1.ts(103,5): error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'T'.
'T' is constrained to be a subtype of'FunctionProperties<T>'.
'T' is constrained to be a subtype of 'FunctionProperties<T>'.
conditionalTypes1.ts(104,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'T'.
'T' is constrained to be a subtype of'NonFunctionProperties<T>'.
'T' is constrained to be a subtype of 'NonFunctionProperties<T>'.
conditionalTypes1.ts(106,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'FunctionProperties<T>'.
Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
Expand Down Expand Up @@ -212,11 +212,11 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
x = y; // Error
~
!!! error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'FunctionProperties<T>'.
!!! error TS2322: 'T' is constrained to be a subtype of 'FunctionProperties<T>'.
x = z; // Error
~
!!! error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'NonFunctionProperties<T>'.
!!! error TS2322: 'T' is constrained to be a subtype of 'NonFunctionProperties<T>'.
y = x;
y = z; // Error
~
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/conditionalTypes2.errors.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
conditionalTypes2.ts(15,5): error TS2322: Type 'Covariant<A>' is not assignable to type 'Covariant<B>'.
Type 'A' is not assignable to type 'B'.
'B' is constrained to be a subtype of'A'.
'B' is constrained to be a subtype of 'A'.
conditionalTypes2.ts(19,5): error TS2322: Type 'Contravariant<B>' is not assignable to type 'Contravariant<A>'.
Type 'A' is not assignable to type 'B'.
'B' is constrained to be a subtype of'A'.
'B' is constrained to be a subtype of 'A'.
conditionalTypes2.ts(24,5): error TS2322: Type 'Invariant<B>' is not assignable to type 'Invariant<A>'.
Types of property 'foo' are incompatible.
Type 'B extends string ? keyof B : B' is not assignable to type 'A extends string ? keyof A : A'.
Expand All @@ -23,7 +23,7 @@ conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant<A>' is not assignable
Type 'A | keyof A' is not assignable to type 'B extends string ? keyof B : B'.
Type 'A' is not assignable to type 'B extends string ? keyof B : B'.
Type 'A' is not assignable to type 'B'.
'B' is constrained to be a subtype of'A'.
'B' is constrained to be a subtype of 'A'.
conditionalTypes2.ts(73,12): error TS2345: Argument of type 'Extract<Extract<T, Foo>, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
Expand Down Expand Up @@ -53,7 +53,7 @@ conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Ba
~
!!! error TS2322: Type 'Covariant<A>' is not assignable to type 'Covariant<B>'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: 'B' is constrained to be a subtype of'A'.
!!! error TS2322: 'B' is constrained to be a subtype of 'A'.
!!! related TS2208 conditionalTypes2.ts:13:13: This type parameter might need an `extends B` constraint.
}

Expand All @@ -62,7 +62,7 @@ conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Ba
~
!!! error TS2322: Type 'Contravariant<B>' is not assignable to type 'Contravariant<A>'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: 'B' is constrained to be a subtype of'A'.
!!! error TS2322: 'B' is constrained to be a subtype of 'A'.
!!! related TS2208 conditionalTypes2.ts:18:13: This type parameter might need an `extends B` constraint.
b = a;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Ba
!!! error TS2322: Type 'A | keyof A' is not assignable to type 'B extends string ? keyof B : B'.
!!! error TS2322: Type 'A' is not assignable to type 'B extends string ? keyof B : B'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: 'B' is constrained to be a subtype of'A'.
!!! error TS2322: 'B' is constrained to be a subtype of 'A'.
!!! related TS2208 conditionalTypes2.ts:23:13: This type parameter might need an `extends B` constraint.
!!! related TS2208 conditionalTypes2.ts:23:13: This type parameter might need an `extends B extends string ? keyof B : B` constraint.
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/deeplyNestedMappedTypes.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deeplyNestedMappedTypes.ts(69,5): error TS2322: Type '{ level1: { level2: { foo:
The types of 'level1.level2' are incompatible between these types.
Property 'bar' is missing in type '{ foo: string; }' but required in type '{ foo: string; bar: string; }'.
deeplyNestedMappedTypes.ts(73,5): error TS2322: Type '{ level1: { level2: { foo: string; }; }; }[]' is not assignable to type 'T'.
'T' is constrained to be a subtype of'{ level1: { level2: { foo: string; }; }; }[]'.
'T' is constrained to be a subtype of '{ level1: { level2: { foo: string; }; }; }[]'.
deeplyNestedMappedTypes.ts(77,5): error TS2322: Type '{ level1: { level2: { foo: string; }; }; }[]' is not assignable to type '{ level1: { level2: { foo: string; bar: string; }; }; }[]'.
Type '{ level1: { level2: { foo: string; }; }; }' is not assignable to type '{ level1: { level2: { foo: string; bar: string; }; }; }'.
The types of 'level1.level2' are incompatible between these types.
Expand Down Expand Up @@ -106,7 +106,7 @@ deeplyNestedMappedTypes.ts(77,5): error TS2322: Type '{ level1: { level2: { foo:
return ors; // Error
~~~~~~
!!! error TS2322: Type '{ level1: { level2: { foo: string; }; }; }[]' is not assignable to type 'T'.
!!! error TS2322: 'T' is constrained to be a subtype of'{ level1: { level2: { foo: string; }; }; }[]'.
!!! error TS2322: 'T' is constrained to be a subtype of '{ level1: { level2: { foo: string; }; }; }[]'.
}

function problematicFunction3(ors: (typeof Input.static)[]): Output[] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'.
'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'.
genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'.
'U' is constrained to be a subtype of'T'.
'U' is constrained to be a subtype of 'T'.
genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'.
'V' is constrained to be a subtype of'U'.
'V' is constrained to be a subtype of 'U'.


==== genericCallWithObjectTypeArgsAndInitializers.ts (3 errors) ====
Expand All @@ -18,11 +18,11 @@ genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is
function foo4<T, U extends T>(x: T, y: U = x) { } // error
~~~~~~~~
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' is constrained to be a subtype of'T'.
!!! error TS2322: 'U' is constrained to be a subtype of 'T'.
!!! related TS2208 genericCallWithObjectTypeArgsAndInitializers.ts:6:15: This type parameter might need an `extends U` constraint.
function foo5<T, U extends T>(x: U, y: T = x) { } // ok
function foo6<T, U extends T, V extends U>(x: T, y: U, z: V = y) { } // error
~~~~~~~~
!!! error TS2322: Type 'U' is not assignable to type 'V'.
!!! error TS2322: 'V' is constrained to be a subtype of'U'.
!!! error TS2322: 'V' is constrained to be a subtype of 'U'.
function foo7<T, U extends T, V extends U>(x: V, y: U = x) { } // should be ok
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is constrained to be a subtype of'T'.
'T' is constrained to be a subtype of 'T'.


==== incompatibleAssignmentOfIdenticallyNamedTypes.ts (1 errors) ====
Expand All @@ -11,7 +11,7 @@ incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): error TS2719: Type 'T' is
this.x = a;
~~~~~~
!!! error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2719: 'T' is constrained to be a subtype of'T'.
!!! error TS2719: 'T' is constrained to be a subtype of 'T'.
}
}

Loading

0 comments on commit 8def683

Please sign in to comment.