diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1dd9fb9255b..791123e8479 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15489,7 +15489,7 @@ namespace ts { } } - if (isLiteralType(source) && !(source.flags & TypeFlags.Union) && !isLiteralType(target) && !(target.flags & TypeFlags.Union)) { + if (isLiteralType(source) && !forEachType(target, isUnitType)) { generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } diff --git a/tests/baselines/reference/bigintIndex.errors.txt b/tests/baselines/reference/bigintIndex.errors.txt index daf9fa7562d..216e2d4857f 100644 --- a/tests/baselines/reference/bigintIndex.errors.txt +++ b/tests/baselines/reference/bigintIndex.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type. -tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +tests/cases/compiler/a.ts(14,1): error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type. tests/cases/compiler/b.ts(2,12): error TS1136: Property assignment expected. tests/cases/compiler/b.ts(2,14): error TS1005: ';' expected. @@ -29,7 +29,7 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be key = Symbol(); key = 123n; // should error ~~~ -!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +!!! error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. // Show correct usage of bigint index: explicitly convert to string const bigNum: bigint = 0n; diff --git a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt index fcc4f25694d..8ff291f2e55 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt +++ b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is not assignable to type 'string | number'. - Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsdoc/returns.js (2 errors) ==== @@ -20,6 +20,6 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is function f1() { return 5 || true; ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true | 5' is not assignable to type 'string | number'. -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt index 7ef791997dd..6a7e077de44 100644 --- a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' insideClass: FuncType = function(val) { // error span goes from here ~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. !!! error TS2322: Type 'undefined' is not assignable to type 'string'. switch (val) { case 1: @@ -37,7 +37,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case ~~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. !!! error TS2322: Type 'undefined' is not assignable to type 'string'. switch (val) { case 1: diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 0fffac781bb..5276e42c4de 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. Types of property 'type' are incompatible. Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. + Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'T' is not assignable to type 'ChannelOfType["type"]'. - Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. + Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T'. '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. Type 'T' is not assignable to type 'T & "text"'. - Type '"text" | "email"' is not assignable to type 'T & "text"'. + Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T'. '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. @@ -60,17 +60,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. !!! error TS2322: Types of property 'type' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. +!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. !!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. +!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. !!! error TS2322: Type 'T' is not assignable to type 'T & "text"'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index f4175aa7934..e15d0ba769c 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -45,7 +45,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. Type 'number' is not assignable to type 'T'. '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '"" | 0' is not assignable to type 'T'. + Type 'string | number' is not assignable to type 'T'. '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. @@ -285,7 +285,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. !!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. +!!! error TS2322: Type 'string | number' is not assignable to type 'T'. !!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. diff --git a/tests/baselines/reference/controlFlowArrayErrors.errors.txt b/tests/baselines/reference/controlFlowArrayErrors.errors.txt index 317dba264ef..91ff3032c62 100644 --- a/tests/baselines/reference/controlFlowArrayErrors.errors.txt +++ b/tests/baselines/reference/controlFlowArrayErrors.errors.txt @@ -4,8 +4,8 @@ tests/cases/compiler/controlFlowArrayErrors.ts(11,9): error TS7034: Variable 'x' tests/cases/compiler/controlFlowArrayErrors.ts(13,13): error TS7005: Variable 'x' implicitly has an 'any[]' type. tests/cases/compiler/controlFlowArrayErrors.ts(19,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. tests/cases/compiler/controlFlowArrayErrors.ts(22,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. -tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. -tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/compiler/controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/controlFlowArrayErrors.ts(60,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. @@ -55,14 +55,14 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f5() { let x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f6() { diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index b959911266b..12beead1afb 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Property 'z' is missing in type '{}' but required in type '{ z: number; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'boolean' is not assignable to type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,11): error TS2322: Type 'boolean' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. @@ -98,7 +98,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2322: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:29:20: The expected type comes from property 'b' which is declared here on type '{ b: string | number; }' c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~ diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 1f7d1b48d60..98a9ff93f70 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2552: Cannot find name 'array2'. Did you mean 'Array'? tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,11): error TS2322: Type 'string' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. @@ -37,7 +37,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? diff --git a/tests/baselines/reference/noErrorTruncation.errors.txt b/tests/baselines/reference/noErrorTruncation.errors.txt index d5244df81a8..0bc6d295c02 100644 --- a/tests/baselines/reference/noErrorTruncation.errors.txt +++ b/tests/baselines/reference/noErrorTruncation.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. ==== tests/cases/compiler/noErrorTruncation.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not const x: SomeLongOptionA ~ -!!! error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +!!! error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 8b5518e958f..7996f2807cf 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -21,7 +21,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: C, a: number, b: string) => string, thisArg: C): (a: number, b: string) => string', gave the following error. @@ -45,7 +45,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -74,7 +74,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f04 = overloaded.bind(undefined); // typeof overloaded @@ -128,7 +128,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f14 = c.foo.bind(undefined); // Error ~~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. !!! error TS2769: The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. C.call(c, 10, "hello"); diff --git a/tests/baselines/reference/tsxAttributeResolution14.errors.txt b/tests/baselines/reference/tsxAttributeResolution14.errors.txt index 71b5e329f48..84fa7789688 100644 --- a/tests/baselines/reference/tsxAttributeResolution14.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution14.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not as // ok // error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature. ) diff --git a/tests/baselines/reference/typeOfOperator1.errors.txt b/tests/baselines/reference/typeOfOperator1.errors.txt index b83f1c01ded..6349e2b4eec 100644 --- a/tests/baselines/reference/typeOfOperator1.errors.txt +++ b/tests/baselines/reference/typeOfOperator1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. +tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -7,5 +7,5 @@ tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "nu var y: string = typeof x; var z: number = typeof x; ~ -!!! error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file