mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 15:44:16 -06:00
Eased up on some of the more aggressive reporting changes
This commit is contained in:
parent
af4ea605f2
commit
769a2f2cfc
@ -4073,9 +4073,6 @@ namespace ts {
|
||||
leftStr = getTypeNameForErrorDisplay(left);
|
||||
rightStr = getTypeNameForErrorDisplay(right);
|
||||
}
|
||||
else if (isLiteralType(left) && !isLiteralType(right)) {
|
||||
leftStr = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(left))
|
||||
}
|
||||
return [leftStr, rightStr];
|
||||
}
|
||||
|
||||
@ -15458,6 +15455,7 @@ namespace ts {
|
||||
function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) {
|
||||
if (incompatibleStack.length) reportIncompatibleStack();
|
||||
const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target);
|
||||
let generalizedSourceType = sourceType;
|
||||
|
||||
if (target.flags & TypeFlags.TypeParameter) {
|
||||
const constraint = getBaseConstraintOfType(target);
|
||||
@ -15491,7 +15489,11 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
reportError(message, sourceType, targetType);
|
||||
if (isLiteralType(source) && !isLiteralType(target)) {
|
||||
generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source))
|
||||
}
|
||||
|
||||
reportError(message, generalizedSourceType, targetType);
|
||||
}
|
||||
|
||||
function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) {
|
||||
|
||||
@ -175,7 +175,7 @@ bar();`
|
||||
file,
|
||||
syntax: [],
|
||||
semantic: [
|
||||
createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["number", "string"]),
|
||||
createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["10", "string"]),
|
||||
],
|
||||
suggestion: []
|
||||
},
|
||||
|
||||
@ -166,7 +166,7 @@ fnErr();
|
||||
{ line: 6, offset: 12 },
|
||||
{ line: 6, offset: 13 },
|
||||
Diagnostics.Type_0_is_not_assignable_to_type_1,
|
||||
["number", "string"],
|
||||
["10", "string"],
|
||||
"error",
|
||||
)
|
||||
],
|
||||
@ -235,7 +235,7 @@ fnErr();
|
||||
{ line: 6, offset: 5 },
|
||||
{ line: 6, offset: 6 },
|
||||
Diagnostics.Type_0_is_not_assignable_to_type_1,
|
||||
["number", "string"],
|
||||
["10", "string"],
|
||||
"error",
|
||||
)
|
||||
],
|
||||
|
||||
@ -10,12 +10,12 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t
|
||||
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'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'.
|
||||
'"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 'string' is not assignable to type 'T & "text"'.
|
||||
Type 'string' is not assignable to type 'T'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'.
|
||||
'"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 '"text"'.
|
||||
Type '"text" | "email"' is not assignable to type '"text"'.
|
||||
Type '"email"' is not assignable to type '"text"'.
|
||||
@ -68,12 +68,12 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t
|
||||
!!! 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: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'.
|
||||
!!! 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 'string' is not assignable to type 'T & "text"'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'.
|
||||
!!! 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 '"text"'.
|
||||
!!! error TS2322: Type '"text" | "email"' is not assignable to type '"text"'.
|
||||
!!! error TS2322: Type '"email"' is not assignable to type '"text"'.
|
||||
|
||||
@ -44,11 +44,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2
|
||||
Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'.
|
||||
'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'.
|
||||
'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
'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'.
|
||||
'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
'"" | 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'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
'""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string | number' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string' is not assignable to type 'ZeroOf<T>'.
|
||||
@ -284,11 +284,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
!!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'.
|
||||
!!! 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: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
!!! 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: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
!!! 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: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'.
|
||||
@ -22,7 +22,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
|
||||
constructor(x: T = 1, public y: U = x) { // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
|
||||
@ -3,9 +3,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
'""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
'""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E<string>' is not assignable to type 'C<number>'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
@ -52,12 +52,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
foo(): T {
|
||||
return ''; // error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'.
|
||||
Type 'string' is not assignable to type '1'.
|
||||
|
||||
@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r10 = foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = foo3(1, (x: T) => '', ''); // error
|
||||
@ -62,13 +62,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r11b = foo3(1, (x: T) => '', 1); // error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r12 = foo3(1, function (a) { return '' }, 1); // error
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'.
|
||||
|
||||
@ -4,7 +4,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'.
|
||||
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
Types of parameters 'a' and 'x' are incompatible.
|
||||
Type 'Date' is not assignable to type 'T'.
|
||||
@ -13,7 +13,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'.
|
||||
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
Types of parameters 'a' and 'x' are incompatible.
|
||||
Type 'Date' is not assignable to type 'T'.
|
||||
@ -48,7 +48,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
var r10 = r7(1); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
}
|
||||
|
||||
function foo2<T extends Date>(a: (x: T) => T, b: (x: T) => T) {
|
||||
@ -97,7 +97,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
var r10 = r7(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
}
|
||||
|
||||
function foo2<T extends Date, U extends Date>(a: (x: T) => T, b: (x: U) => U) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/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'.
|
||||
'1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'.
|
||||
@ -16,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC
|
||||
function foo3<T extends Number>(x: T = 1) { } // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'.
|
||||
!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'.
|
||||
function foo4<T, U extends T>(x: T, y: U = x) { } // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1.
|
||||
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1.
|
||||
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1.
|
||||
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1.
|
||||
@ -18,7 +18,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17
|
||||
var r2 = f(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r3 = f<any>(null);
|
||||
~~~
|
||||
!!! error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'.
|
||||
Type 'string' is not assignable to type '1'.
|
||||
|
||||
@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r10 = c.foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = c3.foo3(1, (x: T) => '', ''); // error
|
||||
@ -84,13 +84,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r11b = c3.foo3(1, (x: T) => '', 1); // error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r12 = c3.foo3(1, function (a) { return '' }, 1); // error
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1.
|
||||
tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
@ -14,7 +14,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe
|
||||
var f = <T>(x: B<T>) => { return x.foo(1); } // error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var f2 = <T>(x: B<T>) => { return x.foo<T>(1); } // error
|
||||
~
|
||||
!!! error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts (6 errors) ====
|
||||
@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
b = "bar" === y;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
b = x !== y;
|
||||
b = "foo" !== y
|
||||
@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
b = "bar" !== y;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts (6 errors) ====
|
||||
@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
b = "bar" == y;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
b = x != y;
|
||||
b = "foo" != y
|
||||
@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap.
|
||||
b = "bar" != y;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1.
|
||||
tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro
|
||||
var r2 = f(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
var r3 = f<any>(null);
|
||||
~~~
|
||||
!!! error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user