Excluded type unions from the generale source types
This commit is contained in:
parent
035b9ac1c1
commit
d12b741004
17 changed files with 57 additions and 57 deletions
|
@ -15489,7 +15489,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (isLiteralType(source) && !isLiteralType(target)) {
|
||||
if (isLiteralType(source) && !(source.flags & TypeFlags.Union) && !isLiteralType(target) && !(target.flags & TypeFlags.Union)) {
|
||||
generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 'bigint' is not assignable to type 'string | number | symbol'.
|
||||
tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' 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 'bigint' is not assignable to type 'string | number | symbol'.
|
||||
!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'.
|
||||
|
||||
// Show correct usage of bigint index: explicitly convert to string
|
||||
const bigNum: bigint = 0n;
|
||||
|
|
|
@ -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 'number | boolean' is not assignable to type 'string | number'.
|
||||
Type 'boolean' is not assignable to type 'string | number'.
|
||||
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 (2 errors) ====
|
||||
|
@ -20,6 +20,6 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boo
|
|||
function f1() {
|
||||
return 5 || true;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'true | 5' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string | number'.
|
||||
}
|
|
@ -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 'string | undefined' is not assignable to type 'string'.
|
||||
Type '"1" | "2" | "3" | "4" | "5" | 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 'string | undefined' is not assignable to type 'string'.
|
||||
Type '"1" | "2" | "3" | "4" | "5" | 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 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | 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 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
switch (val) {
|
||||
case 1:
|
||||
|
|
|
@ -2,17 +2,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t
|
|||
Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick<ChannelOfType<T, TextChannel> | ChannelOfType<T, EmailChannel>, "type">'.
|
||||
Types of property 'type' are incompatible.
|
||||
Type 'T' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type 'T' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["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 'string' 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"' 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<T, TextChannel> | ChannelOfType<T, EmailChannel>, "type">'.
|
||||
!!! error TS2322: Types of property 'type' are incompatible.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType<T, TextChannel>["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 'string' 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'.
|
||||
!!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'.
|
||||
|
|
|
@ -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 'string | number' is not assignable to type 'T'.
|
||||
Type '"" | 0' 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 'string | number' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '"" | 0' 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'.
|
||||
|
|
|
@ -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 '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(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(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 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
!!! error TS2345: Argument of type 'true' 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 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'.
|
||||
}
|
||||
|
||||
function f6() {
|
||||
|
|
|
@ -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 'boolean' is not assignable to type 'string | 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(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 'boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'true' 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]]]
|
||||
~~~~~
|
||||
|
|
|
@ -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 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
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(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 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
!!! error TS2345: Argument of type 'true' 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'?
|
||||
|
|
|
@ -6,7 +6,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(4,5): error TS2322: Type '{ a:
|
|||
tests/cases/compiler/intersectionPropertyCheck.ts(7,3): error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string | undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'string | undefined'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'.
|
||||
tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'true' is not assignable to type 'string[] | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/intersectionPropertyCheck.ts (4 errors) ====
|
||||
|
@ -40,7 +40,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'bo
|
|||
function test<T extends object>(value: T): Test {
|
||||
return { ...value, hi: true }
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string[] | undefined'.
|
||||
!!! related TS6500 tests/cases/compiler/intersectionPropertyCheck.ts:13:12: The expected type comes from property 'hi' which is declared here on type 'Test'
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
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(10,7): error TS2322: Type '42' 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 'number' is
|
|||
|
||||
const x: SomeLongOptionA
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'.
|
||||
!!! error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'.
|
||||
| SomeLongOptionB
|
||||
| SomeLongOptionC
|
||||
| SomeLongOptionD
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(4,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'.
|
||||
tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectCreate-errors.ts (8 errors) ====
|
||||
var e1 = Object.create(1); // Error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'.
|
||||
var e2 = Object.create("string"); // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'.
|
||||
var e3 = Object.create(false); // Error
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'.
|
||||
var e4 = Object.create(undefined); // Error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'.
|
||||
|
@ -25,13 +25,13 @@ tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of ty
|
|||
|
||||
var e5 = Object.create(1, {}); // Error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'.
|
||||
var e6 = Object.create("string", {}); // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'.
|
||||
var e7 = Object.create(false, {}); // Error
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'.
|
||||
!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'.
|
||||
var e8 = Object.create(undefined, {}); // Error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'.
|
|
@ -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 'number' is not assignable to type 'string'.
|
||||
Type '10 | 20' 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 'number' is not assignable to type 'string'.
|
||||
Type '10 | 20' 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 'number' is not assignable to type 'string'.
|
||||
Type '10 | 20' 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 'number' is not assignable to type 'string'.
|
||||
!!! error TS2769: Type '10 | 20' 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 'number' is not assignable to type 'string'.
|
||||
!!! error TS2769: Type '10 | 20' 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 'number' is not assignable to type 'string'.
|
||||
!!! error TS2769: Type '10 | 20' is not assignable to type 'string'.
|
||||
!!! error TS2769: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
C.call(c, 10, "hello");
|
||||
|
|
|
@ -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 'boolean' is not assignable to type 'string | number'.
|
||||
tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' 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 'boolean' is not
|
|||
<VerticalNavMenuItem justRandomProp={2} primaryText={"hello"} /> // ok
|
||||
<VerticalNavMenuItem justRandomProp1={true} primaryText={"hello"} /> // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'true' 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.
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@ tests/cases/conformance/salsa/a.js(10,5): error TS7008: Member 'twices' implicit
|
|||
tests/cases/conformance/salsa/a.js(14,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(21,5): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(24,5): error TS2322: Type 'null' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'boolean' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'false' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null'.
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null
|
|||
!!! error TS2322: Type 'null' is not assignable to type 'string | undefined'.
|
||||
this.twice = false // error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string | undefined'.
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string | undefined'.
|
||||
this.twices.push(1) // error: Object is possibly null
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2531: Object is possibly 'null'.
|
||||
|
|
|
@ -3,7 +3,7 @@ tests/cases/conformance/salsa/a.js(4,5): error TS7008: Member 'unknowable' impli
|
|||
tests/cases/conformance/salsa/a.js(5,5): error TS7008: Member 'empty' implicitly has an 'any[]' type.
|
||||
tests/cases/conformance/salsa/a.js(25,12): error TS7006: Parameter 'a' implicitly has an 'any' type.
|
||||
tests/cases/conformance/salsa/a.js(25,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type.
|
||||
tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type '"error"' is not assignable to type 'number | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/a.js (6 errors) ====
|
||||
|
@ -55,7 +55,7 @@ tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type 'string' is not ass
|
|||
b = undefined
|
||||
b = 'error'
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! error TS2322: Type '"error"' is not assignable to type 'number | undefined'.
|
||||
|
||||
// l should be any[]
|
||||
l.push(1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' 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' is not
|
|||
var y: string = typeof x;
|
||||
var z: number = typeof x;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! 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'.
|
Loading…
Reference in a new issue