mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Report primitive type in literal-to-primitive relation complaints
This commit is contained in:
@@ -4070,12 +4070,19 @@ namespace ts {
|
||||
let leftStr = symbolValueDeclarationIsContextSensitive(left.symbol) ? typeToString(left, left.symbol.valueDeclaration) : typeToString(left);
|
||||
let rightStr = symbolValueDeclarationIsContextSensitive(right.symbol) ? typeToString(right, right.symbol.valueDeclaration) : typeToString(right);
|
||||
if (leftStr === rightStr) {
|
||||
leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType);
|
||||
rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType);
|
||||
leftStr = getTypeNameForErrorDisplay(left);
|
||||
rightStr = getTypeNameForErrorDisplay(right);
|
||||
}
|
||||
else if (isLiteralType(left) && !isLiteralType(right)) {
|
||||
leftStr = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(left))
|
||||
}
|
||||
return [leftStr, rightStr];
|
||||
}
|
||||
|
||||
function getTypeNameForErrorDisplay(type: Type) {
|
||||
return typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType);
|
||||
}
|
||||
|
||||
function symbolValueDeclarationIsContextSensitive(symbol: Symbol): boolean {
|
||||
return symbol && symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type '1' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (3 errors) ====
|
||||
@@ -10,9 +10,9 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'string | number' is not an array type.
|
||||
~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,48): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,48): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,47): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,47): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
public get AnnotatedSetter_SetterLast() { return ""; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
public set AnnotatedSetter_SetterLast(a: number) { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -39,13 +39,13 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
public get AnnotatedGetter_GetterLast(): string { return ""; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'.
|
||||
tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'.
|
||||
tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")' is not assignable to type 'number'.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof impo
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'.
|
||||
var y = 1;
|
||||
y = moduleA; // should be error
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to type 'WatchHandler<any>'.
|
||||
tests/cases/compiler/app.js(6,7): error TS2322: Type 'number' is not assignable to type 'WatchHandler<any>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/func.ts (0 errors) ====
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to ty
|
||||
data1(val) {
|
||||
this.data2 = 1;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'WatchHandler<any>'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'WatchHandler<any>'.
|
||||
},
|
||||
data2(val) { },
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type '10' is not assignable to type 'IArguments'.
|
||||
tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ====
|
||||
@@ -6,5 +6,5 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS
|
||||
function foo(a) {
|
||||
arguments = 10; /// This shouldnt be of type number and result in error.
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '10' is not assignable to type 'IArguments'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'IArguments'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2739: Type '[]' is missing the following properties from type '[any, any, any]': 0, 1, 2
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,38): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,48): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '4' is not assignable to type '2'.
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
|
||||
// The resulting type an array literal expression is determined as follows:
|
||||
// - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type '"hello"' is not assignable to type '(n: number) => boolean'.
|
||||
tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignToFn.ts (1 errors) ====
|
||||
@@ -11,6 +11,6 @@ tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type '"hello"' is not ass
|
||||
|
||||
x.f="hello";
|
||||
~~~
|
||||
!!! error TS2322: Type '"hello"' is not assignable to type '(n: number) => boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'.
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type '"foo"' is not assignable to type '{ [index: string]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is not assignable to type '{ [index: number]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ====
|
||||
@@ -20,10 +20,10 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is n
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
~
|
||||
!!! error TS2322: Type '"foo"' is not assignable to type '{ [index: string]: any; }'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
z = "foo"; // OK, string has numeric indexer
|
||||
z = false; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'false' is not assignable to type '{ [index: number]: any; }'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,17): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,17): error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'.
|
||||
Property 'id' is missing in type '{ name: string; }' but required in type '{ id: number; name?: string; }'.
|
||||
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS
|
||||
foo({ id: 1234, name: "hello" }); // Ok
|
||||
foo({ id: 1234, name: false }); // Error, name of wrong type
|
||||
~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts:1:31: The expected type comes from property 'name' which is declared here on type '{ id: number; name?: string; }'
|
||||
foo({ name: "hello" }); // Error, id required but missing
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'.
|
||||
Property 'apply' is missing in type '{}' but required in type 'Applicable'.
|
||||
|
||||
@@ -21,14 +21,14 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
|
||||
// Should fail
|
||||
x = '';
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'Applicable'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Applicable'.
|
||||
x = [''];
|
||||
~
|
||||
!!! error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'.
|
||||
!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here.
|
||||
x = 4;
|
||||
~
|
||||
!!! error TS2322: Type '4' is not assignable to type 'Applicable'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Applicable'.
|
||||
x = {};
|
||||
~
|
||||
!!! error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'.
|
||||
@@ -43,13 +43,13 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
|
||||
// Should Fail
|
||||
fn('');
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Applicable'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
|
||||
fn(['']);
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'.
|
||||
fn(4);
|
||||
~
|
||||
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'Applicable'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'.
|
||||
fn({});
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'.
|
||||
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'.
|
||||
Property 'call' is missing in type '{}' but required in type 'Callable'.
|
||||
|
||||
@@ -21,14 +21,14 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
|
||||
// Should fail
|
||||
x = '';
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'Callable'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Callable'.
|
||||
x = [''];
|
||||
~
|
||||
!!! error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'.
|
||||
!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here.
|
||||
x = 4;
|
||||
~
|
||||
!!! error TS2322: Type '4' is not assignable to type 'Callable'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Callable'.
|
||||
x = {};
|
||||
~
|
||||
!!! error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'.
|
||||
@@ -43,13 +43,13 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
|
||||
// Should Fail
|
||||
fn('');
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Callable'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'.
|
||||
fn(['']);
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'.
|
||||
fn(4);
|
||||
~
|
||||
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'Callable'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'.
|
||||
fn({});
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(4,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(5,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(13,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(14,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(5,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(13,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(14,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,2): error TS2539: Cannot assign to 'M' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2539: Cannot assign to 'M3' because it is not a variable.
|
||||
@@ -11,13 +11,13 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,13): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2539: Cannot assign to 'fn' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,2): error TS2539: Cannot assign to 'fn' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(62,1): error TS2539: Cannot assign to 'E' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(63,2): error TS2539: Cannot assign to 'E' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(69,1): error TS2539: Cannot assign to 'C' because it is not a variable.
|
||||
@@ -30,10 +30,10 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
(x) = 3; // OK
|
||||
x = ''; // Error
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(x) = ''; // Error
|
||||
~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
module M {
|
||||
export var y: number;
|
||||
@@ -43,13 +43,13 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
(M.y) = 3; // OK
|
||||
M.y = ''; // Error
|
||||
~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(M).y = ''; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(M.y) = ''; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
M = { y: 3 }; // Error
|
||||
~
|
||||
@@ -98,32 +98,32 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
(x) = 3; // OK
|
||||
x = ''; // Error
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(x) = ''; // Error
|
||||
~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
(y).t = 3; // OK
|
||||
(y.t) = 3; // OK
|
||||
(y).t = ''; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(y.t) = ''; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
y['t'] = 3; // OK
|
||||
(y)['t'] = 3; // OK
|
||||
(y['t']) = 3; // OK
|
||||
y['t'] = ''; // Error
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(y)['t'] = ''; // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(y['t']) = ''; // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
}
|
||||
|
||||
enum E {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2345: Argument of type '() => Promise<number>' is not assignable to parameter of type '() => string'.
|
||||
Type 'Promise<number>' is not assignable to type 'string'.
|
||||
|
||||
@@ -10,20 +10,20 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2
|
||||
/** @type {function(): string} */
|
||||
const a = () => 0
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
// Error (good)
|
||||
/** @type {function(): string} */
|
||||
const b = async () => 0
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
// No error (bad)
|
||||
/** @type {function(): string} */
|
||||
const c = async () => {
|
||||
return 0
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
/** @type {function(function(): string): void} */
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. D
|
||||
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
|
||||
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
|
||||
@@ -40,7 +40,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
|
||||
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
~~~~
|
||||
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,8 +22,8 @@ tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches
|
||||
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
|
||||
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
|
||||
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
|
||||
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
|
||||
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
|
||||
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bigintWithLib.ts (7 errors) ====
|
||||
@@ -97,12 +97,12 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
|
||||
dataView.setBigInt64(1, -1n, true);
|
||||
dataView.setBigInt64(1, -1); // should error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
|
||||
dataView.setBigUint64(2, 123n);
|
||||
dataView.setBigUint64(2, 123n, true);
|
||||
dataView.setBigUint64(2, 123); // should error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
|
||||
bigintVal = dataView.getBigInt64(1);
|
||||
bigintVal = dataView.getBigInt64(1, true);
|
||||
bigintVal = dataView.getBigUint64(2);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type '1' is not assignable to type 'Boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type '"a"' is not assignable to type 'Boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type 'number' is not assignable to type 'Boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type 'string' is not assignable to type 'Boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'.
|
||||
The types returned by 'valueOf()' are incompatible between these types.
|
||||
Type 'Object' is not assignable to type 'boolean'.
|
||||
@@ -9,10 +9,10 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a
|
||||
var b = new Boolean();
|
||||
b = 1; // Error
|
||||
~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Boolean'.
|
||||
b = "a"; // Error
|
||||
~
|
||||
!!! error TS2322: Type '"a"' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Boolean'.
|
||||
b = {}; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'Boolean'.
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer.
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith
|
||||
~
|
||||
!!! error TS1015: Parameter cannot have question mark and initializer.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
b: (x?: any = '') => { }
|
||||
~
|
||||
!!! error TS1015: Parameter cannot have question mark and initializer.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts (1 errors) ====
|
||||
@@ -12,5 +12,5 @@ tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10)
|
||||
test("expects boolean instead of string"); // should not error - "test" should not expect a boolean
|
||||
test(true); // should error - string expected
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I<number>' and 'I<string>'.
|
||||
Named property 'foo' of types 'I<number>' and 'I<string>' are not identical.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts (2 errors) ====
|
||||
@@ -21,5 +21,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha
|
||||
var r = x.foo(1); // no error
|
||||
var r2 = x.foo(''); // error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
+6
-6
@@ -2,9 +2,9 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
|
||||
'S' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,35): error TS2322: Type 'T' is not assignable to type 'S'.
|
||||
'S' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts (5 errors) ====
|
||||
@@ -49,16 +49,16 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
|
||||
// Should get an error that we are assigning a string to a number
|
||||
(new Chain2(i)).then(ii => t).then(tt => s).value.x = "";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
// Staying at T or S should keep the constraint.
|
||||
// Get an error when we assign a string to a number in both cases
|
||||
(new Chain2(i)).then(ii => t).then(tt => t).then(tt => t).then(tt => t).value.x = "";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
(new Chain2(i)).then(ii => s).then(ss => s).then(ss => s).then(ss => s).value.x = "";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/salsa/use.js(5,5): error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/salsa/use.js(5,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/use.js (2 errors) ====
|
||||
@@ -9,10 +9,10 @@ tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type '"not
|
||||
var b = new mod.B()
|
||||
a.m('nope')
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
b.m('not really')
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
==== tests/cases/conformance/salsa/types.d.ts (0 errors) ====
|
||||
declare function require(name: string): any;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/validator.ts (10 errors) ====
|
||||
@@ -35,13 +35,13 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not
|
||||
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
m1.thing = "no";
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
m1.rwAccessors = "no";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
m1.setonlyAccessor = 0;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
import m2 = require("./mod2");
|
||||
|
||||
@@ -65,13 +65,13 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not
|
||||
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
m2.thing = 0;
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
m2.rwAccessors = "no";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
m2.setonlyAccessor = 0;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ====
|
||||
Object.defineProperty(exports, "thing", { value: 42, writable: true });
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/validator.ts (5 errors) ====
|
||||
@@ -32,13 +32,13 @@ tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not
|
||||
!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property.
|
||||
m1.thing = "no";
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
m1.rwAccessors = "no";
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"no"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
m1.setonlyAccessor = 0;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ====
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/a.js(2,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/a.js(2,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
@@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
@@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
@@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type '5' 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(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 (2 errors) ====
|
||||
@@ -11,7 +11,7 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is
|
||||
function f() {
|
||||
return 5;
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '5' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type '"hello"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
|
||||
tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -12,12 +12,12 @@ tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not as
|
||||
/** @type {String} */
|
||||
var S = true;
|
||||
~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
/** @type {number} */
|
||||
var n = "hello";
|
||||
~
|
||||
!!! error TS2322: Type '"hello"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
/** @type {function (number)} */
|
||||
~~~~~~~~~~~~~~~~~
|
||||
@@ -25,7 +25,7 @@ tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not as
|
||||
const x1 = (a) => a + 1;
|
||||
x1("string");
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
/** @type {function (number): number} */
|
||||
const x2 = (a) => a + 1;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/jsdoc/0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/jsdoc/0.js(8,7): error TS2322: Type '"42"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type '"lol"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type '"0"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(8,7): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/0.js (8 errors) ====
|
||||
@@ -20,16 +20,16 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"'
|
||||
method1(n1) {
|
||||
return "42";
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"42"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
},
|
||||
/** @type {function(number): number} */
|
||||
method2: (n1) => "lol",
|
||||
~~~~~
|
||||
!!! error TS2322: Type '"lol"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
/** @type {function(number): number} */
|
||||
arrowFunc: (num="0") => num + 42,
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '"0"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
/** @type {string} */
|
||||
lol
|
||||
~~~
|
||||
@@ -46,4 +46,4 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"'
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property.
|
||||
tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type '12' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property.
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to
|
||||
!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property.
|
||||
x.zipStr = 12; // should fail
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '12' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
x.middleInit = "R"; // should also fail
|
||||
~~~~~~~~~~
|
||||
!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(7,1): error TS2322: Type 'typeof A' is not assignable to type 'new () => A'.
|
||||
Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type '"asdf"' is not assignable to type 'new () => A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts (2 errors) ====
|
||||
@@ -16,4 +16,4 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
AAA = "asdf";
|
||||
~~~
|
||||
!!! error TS2322: Type '"asdf"' is not assignable to type 'new () => A'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/salsa/first.js(31,5): error TS2416: Property 'load' in t
|
||||
Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'.
|
||||
tests/cases/conformance/salsa/first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type.
|
||||
tests/cases/conformance/salsa/generic.js(19,19): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/salsa/generic.js(20,32): error TS2345: Argument of type '0' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'.
|
||||
tests/cases/conformance/salsa/generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'.
|
||||
tests/cases/conformance/salsa/second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type.
|
||||
tests/cases/conformance/salsa/second.ts(14,7): error TS2417: Class static side 'typeof Conestoga' incorrectly extends base class static side 'typeof Wagon'.
|
||||
Types of property 'circle' are incompatible.
|
||||
@@ -11,7 +11,7 @@ tests/cases/conformance/salsa/second.ts(14,7): error TS2417: Class static side '
|
||||
Types of parameters 'others' and 'wagons' are incompatible.
|
||||
Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'.
|
||||
Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'.
|
||||
tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/first.js (3 errors) ====
|
||||
@@ -102,7 +102,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '
|
||||
// error: wrong type
|
||||
super('nope');
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
}
|
||||
// should error since others is not optional
|
||||
static circle(others: (typeof Wagon)[]) {
|
||||
@@ -138,6 +138,6 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '
|
||||
!!! related TS6210 tests/cases/conformance/salsa/generic.js:5:15: An argument for 'flavour' was not provided.
|
||||
var errorArgType = new Chowder(0);
|
||||
~
|
||||
!!! error TS2345: Argument of type '0' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/classMemberInitializerScoping.ts(3,17): error TS2301: Initializer of instance member variable 'y' cannot reference identifier 'aaa' declared in the constructor.
|
||||
tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classMemberInitializerScoping.ts (2 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type '
|
||||
constructor(aaa) {
|
||||
this.y = ''; // was: error, cannot assign string to number
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '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 '"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:
|
||||
|
||||
+24
-24
@@ -2,20 +2,20 @@ 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 '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["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"] & 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 '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
Type '"text"' is not assignable to type 'T & "text"'.
|
||||
Type '"text"' 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 'string' 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'.
|
||||
'string' 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 '"text"' is not assignable to type 'T & "text"'.
|
||||
Type '"text"' 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 '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"'.
|
||||
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"'.
|
||||
@@ -60,20 +60,20 @@ 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 '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"] & ChannelOfType<T, EmailChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["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"] & 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 '"text" | "email"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text"' is not assignable to type 'ChannelOfType<T, TextChannel>["type"]'.
|
||||
!!! error TS2322: Type '"text"' is not assignable to type 'T & "text"'.
|
||||
!!! error TS2322: Type '"text"' 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 'string' 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: 'string' 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 '"text"' is not assignable to type 'T & "text"'.
|
||||
!!! error TS2322: Type '"text"' 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 '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: 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"'.
|
||||
|
||||
@@ -43,12 +43,12 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2
|
||||
'ZeroOf<T>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
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 '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 '"" | 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 '""' 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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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>'.
|
||||
@@ -283,12 +283,12 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
!!! error TS2322: 'ZeroOf<T>' 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 | (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 '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 '"" | 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 '""' 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'.
|
||||
!!! 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: 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: 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'.
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(13,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.
|
||||
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,12): error TS2476: A const enum member can only be accessed using a string literal.
|
||||
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type '"string"' is not assignable to type 'G'.
|
||||
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type 'string' is not assignable to type 'G'.
|
||||
tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a read-only property.
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS25
|
||||
var g: G;
|
||||
g = "string";
|
||||
~
|
||||
!!! error TS2322: Type '"string"' is not assignable to type 'G'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'G'.
|
||||
function foo(x: G) { }
|
||||
G.B = 3;
|
||||
~
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type '1' is not assignable to type 'string'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
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'.
|
||||
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'.
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
|
||||
constructor(x);
|
||||
constructor(public x: string = 1) { // error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co
|
||||
constructor(x: T, y: U);
|
||||
constructor(x: T = 1, public y: U = x) { // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(8,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(10,9): error TS2322: Type '2' is not assignable to type 'string'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(10,9): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(16,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor.
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterS
|
||||
constructor(x: string) {
|
||||
x = 2; // error, x is string
|
||||
~
|
||||
!!! error TS2322: Type '2' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type '1' is not assignable to type 'X'.
|
||||
tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type 'number' is not assignable to type 'X'.
|
||||
tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return
|
||||
constructor() {
|
||||
return 1;
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'X'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'X'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type 'number' is not assignable to type 'D'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
@@ -19,7 +19,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl
|
||||
constructor() {
|
||||
return 1; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'D'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'D'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,13): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(183,13): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(187,13): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(187,13): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(191,13): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'.
|
||||
@@ -370,7 +370,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
|
||||
i--;/*--*/
|
||||
b = true && false || true;/*&& ||*/
|
||||
~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
i = i << 5;/*<<*/
|
||||
i = i >> 5;/*>>*/
|
||||
var j = i;
|
||||
|
||||
@@ -4,10 +4,10 @@ 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(48,12): error TS2345: Argument of type '99' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type '"hello"' is not assignable to parameter of type '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.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
|
||||
@@ -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() {
|
||||
@@ -78,7 +78,7 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x'
|
||||
x; // boolean[] | (string | number)[]
|
||||
x.push(99); // Error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '99' is not assignable to parameter of type 'never'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'.
|
||||
}
|
||||
|
||||
function f7() {
|
||||
@@ -88,7 +88,7 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x'
|
||||
x.push("hello"); // Ok
|
||||
y.push("hello"); // Error
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
}
|
||||
|
||||
function f8() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type '3' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: Cannot use namespace 'T' as a value.
|
||||
|
||||
@@ -17,7 +17,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
s = f();
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -25,7 +25,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C
|
||||
// Type check the default argument with the type annotation
|
||||
var f2 = function (a: string = 3) { return a; }; // Should error, but be of type (a: string) => string;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '3' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
s = f2('');
|
||||
s = f2();
|
||||
n = f2();
|
||||
@@ -40,7 +40,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C
|
||||
// Type check using the function's contextual type
|
||||
var f4: (a: number) => void = function (a = "") { };
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
// Contextually type the default arg using the function's contextual type
|
||||
var f5: (a: (s: string) => any) => void = function (a = s => <number>s) { };
|
||||
|
||||
@@ -2,10 +2,10 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
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 '""' 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'.
|
||||
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' 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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
@@ -51,13 +51,13 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' 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'.
|
||||
!!! 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'.
|
||||
foo(): T {
|
||||
return ''; // error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' 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'.
|
||||
!!! 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'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(34,6): error TS2322: Type 'number' is not assignable to type '{ x: any; y: { j: any; }; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(35,4): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ z: number; }'.
|
||||
Property 'z' is missing in type '{}' but required in type '{ z: number; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'false' 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(39,11): error TS2322: Type 'false' is not assignable to type '[[any]]'.
|
||||
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(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.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(47,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
|
||||
@@ -91,18 +91,18 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
!!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:27:21: 'z' is declared here.
|
||||
c1({ z: true }); // Error, implied type is {z:number}?
|
||||
~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:27:21: The expected type comes from property 'z' which is declared here on type '{ z: number; }'
|
||||
c2({ z: false }); // Error, implied type is {z?: number}
|
||||
~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'number'.
|
||||
!!! 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]]]
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type '[[any]]'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type '[[any]]'.
|
||||
c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
@@ -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'?
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,19): error TS2322: Type '{ x1: number; x2: string; x3: true; }' is not assignable to type 'ObjType1'.
|
||||
Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,47): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,39): error TS2339: Property 'x1' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,45): error TS2339: Property 'x2' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,51): error TS2339: Property 'x3' does not exist on type 'C1'.
|
||||
@@ -54,7 +54,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
~~
|
||||
!!! error TS2339: Property 'x1' does not exist on type 'C1'.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,56): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(19,16): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1
|
||||
// If the declaration includes a type annotation, T is that type.
|
||||
var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:17: The expected type comes from property 'a1' which is declared here on type '{ a1: number; a2: string; }'
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:29: The expected type comes from property 'a2' which is declared here on type '{ a1: number; a2: string; }'
|
||||
var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type 'number' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' is not assignable to type 'WStatic'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat.ts (5 errors) ====
|
||||
@@ -37,18 +37,18 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is no
|
||||
var a: number = W.a;
|
||||
var b: typeof W = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
!!! error TS2322: Type 'W' is not assignable to type 'typeof W'.
|
||||
var c: typeof W.a = W.a;
|
||||
var d: typeof W = 3; // error
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
var f: WStatic = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
!!! error TS2322: Type 'W' is not assignable to type 'WStatic'.
|
||||
var g: WStatic = 5; // error
|
||||
~
|
||||
!!! error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'WStatic'.
|
||||
var h: W = 3;
|
||||
var i: W = W.a;
|
||||
i = W.a;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type 'number' is not assignable to type 'typeof W'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W' is not assignable to type 'WStatic'.
|
||||
tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' is not assignable to type 'WStatic'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat2.ts (5 errors) ====
|
||||
@@ -36,18 +36,18 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is n
|
||||
var a: number = W.a;
|
||||
var b: typeof W = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'typeof W'.
|
||||
!!! error TS2322: Type 'W' is not assignable to type 'typeof W'.
|
||||
var c: typeof W.a = W.a;
|
||||
var d: typeof W = 3; // error
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type 'typeof W'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'typeof W'.
|
||||
var e: typeof W.a = 4;
|
||||
var f: WStatic = W.a; // error
|
||||
~
|
||||
!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'.
|
||||
!!! error TS2322: Type 'W' is not assignable to type 'WStatic'.
|
||||
var g: WStatic = 5; // error
|
||||
~
|
||||
!!! error TS2322: Type '5' is not assignable to type 'WStatic'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'WStatic'.
|
||||
var h: W = 3;
|
||||
var i: W = W.a;
|
||||
i = W.a;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type '"this is a string"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type '9.9' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type '9.9' is not assignable to type 'Date'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type '9.9' is not assignable to type 'void'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type 'number' is not assignable to type 'void'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2741: Property 'id' is missing in type 'D<unknown>' but required in type 'I'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2741: Property 'id' is missing in type 'D<unknown>' but required in type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2739: Type 'C' is missing the following properties from type 'D<string>': source, recurse, wrapped
|
||||
@@ -60,17 +60,17 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
|
||||
|
||||
var aNumber: number = 'this is a string';
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '"this is a string"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var aString: string = 9.9;
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '9.9' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var aDate: Date = 9.9;
|
||||
~~~~~
|
||||
!!! error TS2322: Type '9.9' is not assignable to type 'Date'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Date'.
|
||||
|
||||
var aVoid: void = 9.9;
|
||||
~~~~~
|
||||
!!! error TS2322: Type '9.9' is not assignable to type 'void'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'void'.
|
||||
|
||||
var anInterface: I = new D();
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'true' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
|
||||
import foo = require("./foo_0");
|
||||
var x = new foo(true); // Should error
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
var y = new foo({a: "test", b: 42}); // Should be OK
|
||||
var z: number = y.test.b;
|
||||
==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ====
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'typeof s' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(28,1): error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
|
||||
@@ -32,7 +32,7 @@ tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argume
|
||||
// Should fail
|
||||
prop = getProperty2(obj, s);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
|
||||
!!! error TS2345: Argument of type 'typeof s' is not assignable to parameter of type 'never'.
|
||||
|
||||
prop = getProperty3(obj, s);
|
||||
~~~~
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,8): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ====
|
||||
function bar<T>(item1: T, item2: T) { }
|
||||
bar(1, ""); // Should be ok
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,7): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,7): error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,18): error TS2322: Type '""' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,18): error TS2322: Ty
|
||||
var map = new Map([["", true]]);
|
||||
for ([k = false, v = ""] of map) {
|
||||
~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'boolean'.
|
||||
k;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionAssignment.ts(22,5): error TS2322: Type '4' is not assignable to type 'string'.
|
||||
tests/cases/compiler/functionAssignment.ts(22,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/functionAssignment.ts(34,17): error TS2339: Property 'length' does not exist on type 'number'.
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/compiler/functionAssignment.ts(34,17): error TS2339: Property 'lengt
|
||||
var n = '';
|
||||
n = 4;
|
||||
~
|
||||
!!! error TS2322: Type '4' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
});
|
||||
|
||||
function f3(a: { a: number; b: number; }) { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/functionCall10.ts(3,5): error TS2345: Argument of type '"foo"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/functionCall10.ts(3,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall10.ts (2 errors) ====
|
||||
@@ -7,9 +7,9 @@ tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type '"ba
|
||||
foo(0, 1);
|
||||
foo('foo');
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type '"foo"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
foo();
|
||||
foo(1, 'bar');
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/functionCall11.ts(4,1): error TS2554: Expected 1-2 arguments, but got 0.
|
||||
tests/cases/compiler/functionCall11.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall11.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 arguments, but got 3.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen
|
||||
!!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 'bar');
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 3.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/functionCall12.ts(4,1): error TS2554: Expected 1-3 arguments, but got 0.
|
||||
tests/cases/compiler/functionCall12.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall12.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall12.ts (3 errors) ====
|
||||
@@ -13,9 +13,9 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3'
|
||||
!!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 'bar');
|
||||
foo('foo', 1, 3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/functionCall13.ts(4,1): error TS2555: Expected at least 1 arguments, but got 0.
|
||||
tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall13.ts (2 errors) ====
|
||||
@@ -12,6 +12,6 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1'
|
||||
!!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall14.ts (1 errors) ====
|
||||
@@ -8,6 +8,6 @@ tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type '1'
|
||||
foo();
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/compiler/functionCall16.ts(2,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall16.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall16.ts(5,1): error TS2555: Expected at least 1 arguments, but got 0.
|
||||
tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall16.ts (3 errors) ====
|
||||
function foo(a:string, b?:string, ...c:number[]){}
|
||||
foo('foo', 1);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo('foo', 'bar');
|
||||
foo();
|
||||
@@ -16,6 +16,6 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1'
|
||||
!!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar', 3);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/functionCall17.ts(2,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall17.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall17.ts(4,1): error TS2555: Expected at least 1 arguments, but got 0.
|
||||
tests/cases/compiler/functionCall17.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall17.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall17.ts (4 errors) ====
|
||||
function foo(a:string, b?:string, c?:number, ...d:number[]){}
|
||||
foo('foo', 1);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
@@ -16,9 +16,9 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1'
|
||||
!!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar', 3, 4);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionCall6.ts(3,5): error TS2345: Argument of type '2' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall6.ts(3,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall6.ts(4,12): error TS2554: Expected 1 arguments, but got 2.
|
||||
tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments,
|
||||
foo('bar');
|
||||
foo(2);
|
||||
~
|
||||
!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar');
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/functionCall7.ts(5,10): error TS2554: Expected 1 arguments, but got 2.
|
||||
tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'.
|
||||
tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments,
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
foo(4);
|
||||
~
|
||||
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
foo();
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/functionCall8.ts(3,12): error TS2554: Expected 0-1 arguments, but got 2.
|
||||
tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type '4' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionCall8.ts (2 errors) ====
|
||||
@@ -10,6 +10,6 @@ tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type '4' i
|
||||
!!! error TS2554: Expected 0-1 arguments, but got 2.
|
||||
foo(4);
|
||||
~
|
||||
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionCall9.ts(4,11): error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/functionCall9.ts(4,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/functionCall9.ts(5,15): error TS2554: Expected 0-2 arguments, but got 3.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall9.ts(5,15): error TS2554: Expected 0-2 argument
|
||||
foo('foo');
|
||||
foo('foo','bar');
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
foo('foo', 1, 'bar');
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 0-2 arguments, but got 3.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(11,7): error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(15,7): error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(18,5): error TS2345: Argument of type '""' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(11,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(18,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,9): error TS2554: Expected 1 arguments, but got 4.
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@ tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,9): error TS255
|
||||
function call0(p: A | B) {
|
||||
p.a("s"); // Error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
}
|
||||
|
||||
function callN<T extends A | B>(p: T) {
|
||||
p.a("s"); // Error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
|
||||
var a: T["a"] = p.a;
|
||||
a(""); // Error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'never'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
a("", "", "", ""); // Error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 4.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'Function'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,16): error TS2554: Expected 1 arguments, but got 2.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,8): error TS2554: Expected 1 arguments, but got 2.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
|
||||
foo(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Function'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
|
||||
foo(() => { }, 1);
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type '5' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads.ts (1 errors) ====
|
||||
@@ -7,4 +7,4 @@ tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type
|
||||
function foo(bar?: string): any { return "" };
|
||||
var x = foo(5);
|
||||
~
|
||||
!!! error TS2345: Argument of type '5' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/functionOverloads2.ts(4,13): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(bar: string): string', gave the following error.
|
||||
Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
Overload 2 of 2, '(bar: number): number', gave the following error.
|
||||
Argument of type 'true' is not assignable to parameter of type 'number'.
|
||||
Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads2.ts (1 errors) ====
|
||||
@@ -13,6 +13,6 @@ tests/cases/compiler/functionOverloads2.ts(4,13): error TS2769: No overload matc
|
||||
~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 2, '(bar: string): string', gave the following error.
|
||||
!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Overload 2 of 2, '(bar: number): number', gave the following error.
|
||||
!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of type '5' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/functionOverloads27.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of typ
|
||||
function foo(bar?:any):any{ return '' }
|
||||
var x = foo(5);
|
||||
~
|
||||
!!! error TS2345: Argument of type '5' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(2,5): error TS2322: Type 'undefined' is not assignable to type 'number'.
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(3,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(3,11): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(4,11): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(5,5): error TS2322: Type '10' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/generators/generatorExplicitReturnType.ts(16,11): error TS2322: Type 'symbol' is not assignable to type 'number'.
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/generators/generatorExplicitReturnType.ts(16,11): error
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'number'.
|
||||
yield "a"; // error
|
||||
~~~
|
||||
!!! error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
const x: number = yield 1; // error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type '1' is not assignable to parameter of type 'Date'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (1 errors) ====
|
||||
@@ -14,5 +14,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
|
||||
var r3 = foo(new Object()); // {}
|
||||
var r4 = foo<Date, Date>(1); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Date'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
|
||||
var r5 = foo<Date, Date>(new Date()); // no error
|
||||
@@ -2,16 +2,16 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
Type 'string' is not assignable to type '1'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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'.
|
||||
|
||||
@@ -53,22 +53,22 @@ 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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
var r10 = foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = foo3(1, (x: T) => '', ''); // 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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
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'.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,18): error TS2345: Argument of type 'I2<string>' is not assignable to parameter of type 'new (a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type '1' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,18): error TS2345: Argument of type 'I2<string>' is not assignable to parameter of type 'new (a: 1) => string'.
|
||||
Types of parameters 'x' and 'a' are incompatible.
|
||||
Type '1' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts (2 errors) ====
|
||||
@@ -39,7 +39,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'I2<string>' is not assignable to parameter of type 'new (a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type '1' is not assignable to type 'string'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var r4b = foo2(1, a); // any
|
||||
var r5 = foo2(1, i); // any
|
||||
var r6 = foo2<string, string>('', i2); // string
|
||||
@@ -54,5 +54,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'I2<string>' is not assignable to parameter of type 'new (a: 1) => string'.
|
||||
!!! error TS2345: Types of parameters 'x' and 'a' are incompatible.
|
||||
!!! error TS2345: Type '1' is not assignable to type 'string'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
var r9 = foo3<string, string>('', i2, ''); // string
|
||||
@@ -3,8 +3,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
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 '1' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
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'.
|
||||
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'.
|
||||
@@ -12,8 +12,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'.
|
||||
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 '1' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
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'.
|
||||
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'.
|
||||
@@ -47,8 +47,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
!!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
|
||||
var r10 = r7(1); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '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'.
|
||||
}
|
||||
|
||||
function foo2<T extends Date>(a: (x: T) => T, b: (x: T) => T) {
|
||||
@@ -96,8 +96,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
!!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
|
||||
var r10 = r7(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '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'.
|
||||
}
|
||||
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'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(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'.
|
||||
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'.
|
||||
@@ -15,8 +15,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC
|
||||
function foo2<T>(x: T = undefined) { return x; } // ok
|
||||
function foo3<T extends Number>(x: T = 1) { } // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'T'.
|
||||
!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'.
|
||||
!!! 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'.
|
||||
function foo4<T, U extends T>(x: T, y: U = x) { } // error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
|
||||
+4
-4
@@ -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 '1' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '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'.
|
||||
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.
|
||||
@@ -17,8 +17,8 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17
|
||||
!!! error TS2558: Expected 0 type arguments, but got 1.
|
||||
var r2 = f(1);
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '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'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
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'.
|
||||
|
||||
@@ -75,22 +75,22 @@ 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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
var r10 = c.foo2(1, (x) => ''); // string
|
||||
|
||||
var r11 = c3.foo3(1, (x: T) => '', ''); // 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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
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 '1' is not assignable to type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
!!! 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'.
|
||||
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'.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(6,39): error TS2344: Type 'number'
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(10,5): error TS2558: Expected 2-3 type arguments, but got 1.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(13,5): error TS2558: Expected 2-3 type arguments, but got 4.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(19,11): error TS2428: All declarations of 'i00' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(22,11): error TS2428: All declarations of 'i01' must have identical type parameters.
|
||||
@@ -59,7 +59,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet
|
||||
f12<number>(); // ok
|
||||
f12<number>("a"); // error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
interface i00<T> { } // ok
|
||||
~~~
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/compiler/genericNewInterface.ts(2,21): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of type '1024' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/genericNewInterface.ts(2,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericNewInterface.ts (2 errors) ====
|
||||
function createInstance<T>(ctor: new (s: string) => T): T {
|
||||
return new ctor(42); //should be an error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
|
||||
interface INewable<T> {
|
||||
@@ -16,5 +16,5 @@ tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of ty
|
||||
function createInstance2<T>(ctor: INewable<T>): T {
|
||||
return new ctor(1024); //should be an error
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '1024' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
tests/cases/compiler/genericRestArgs.ts(2,26): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(10,29): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '1' is not assignable to parameter of type 'any[]'.
|
||||
tests/cases/compiler/genericRestArgs.ts(2,26): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(10,29): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericRestArgs.ts (4 errors) ====
|
||||
function makeArrayG<T>(...items: T[]): T[] { return items; }
|
||||
var a1Ga = makeArrayG(1, ""); // no error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
var a1Gb = makeArrayG<any>(1, "");
|
||||
var a1Gc = makeArrayG<Object>(1, "");
|
||||
var a1Gd = makeArrayG<number>(1, ""); // error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
function makeArrayGOpt<T>(item1?: T, item2?: T, item3?: T) {
|
||||
return [item1, item2, item3];
|
||||
}
|
||||
var a2Ga = makeArrayGOpt(1, "");
|
||||
~~
|
||||
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
var a2Gb = makeArrayG<any>(1, "");
|
||||
var a2Gc = makeArrayG<any[]>(1, ""); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'any[]'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(17,11): error TS2345: Argument of type '[10]' is not assignable to parameter of type '[string] | [number, boolean]'.
|
||||
Type '[10]' is not assignable to type '[string]'.
|
||||
Type '10' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(18,1): error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'.
|
||||
Type '[]' is missing the following properties from type '[number, boolean]': 0, 1
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(22,1): error TS2322: Type '(x: string, ...args: [string] | [number, boolean]) => void' is not assignable to type '(...args: [string, string] | [string, number, boolean]) => void'.
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(24,1): error TS2322
|
||||
Property '1' is missing in type '[string]' but required in type '[number, boolean]'.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(25,1): error TS2322: Type '(...args: [string, string] | [string, number, boolean]) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(35,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(36,21): error TS2345: Argument of type '100' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(36,21): error TS2345: Argument of type 'number' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
tests/cases/conformance/types/rest/genericRestParameters3.ts(37,21): error TS2345: Argument of type '<T extends any[]>(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
Types of parameters 'cb' and 'args' are incompatible.
|
||||
Property '0' is missing in type 'CoolArray<any>' but required in type '[(...args: any[]) => void]'.
|
||||
@@ -55,7 +55,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345
|
||||
~~
|
||||
!!! error TS2345: Argument of type '[10]' is not assignable to parameter of type '[string] | [number, boolean]'.
|
||||
!!! error TS2345: Type '[10]' is not assignable to type '[string]'.
|
||||
!!! error TS2345: Type '10' is not assignable to type 'string'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
f1("foo"); // Error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'.
|
||||
@@ -98,7 +98,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345
|
||||
!!! related TS6210 tests/cases/conformance/types/rest/genericRestParameters3.ts:33:39: An argument for 'cb' was not provided.
|
||||
foo<CoolArray<any>>(100); // Error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '100' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
foo<CoolArray<any>>(foo); // Error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '<T extends any[]>(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray<any>) => void'.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '1'.
|
||||
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'.
|
||||
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.
|
||||
|
||||
@@ -13,8 +13,8 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe
|
||||
x.foo(1); // no error
|
||||
var f = <T>(x: B<T>) => { return x.foo(1); } // error
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'.
|
||||
!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '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'.
|
||||
var f2 = <T>(x: B<T>) => { return x.foo<T>(1); } // error
|
||||
~
|
||||
!!! error TS2558: Expected 0 type arguments, but got 1.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,9): error TS2322: Type '"string"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts (1 errors) ====
|
||||
@@ -11,7 +11,7 @@ tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyp
|
||||
get X() {
|
||||
return "string"; // Error; get contextual type by set accessor parameter type annotation
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"string"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
}
|
||||
|
||||
set Y(y) { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/salsa/bug27099.js(1,1): error TS2322: Type '1' is not assignable to type 'string'.
|
||||
tests/cases/conformance/salsa/bug27099.js(1,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/bug27099.js (1 errors) ====
|
||||
window.name = 1;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
window.console; // should not have error: Property 'console' does not exist on type 'typeof window'.
|
||||
module.exports = 'anything';
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2769: No overload match
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type '5' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
||||
|
||||
var i1c1: { (): string; } = 5;
|
||||
~~~~
|
||||
!!! error TS2322: Type '5' is not assignable to type '() => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
|
||||
var fp1: () =>any = a => 0;
|
||||
~~~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexIntoArraySubclass.ts (1 errors) ====
|
||||
@@ -7,4 +7,4 @@ tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type '0' is n
|
||||
var r = x2[0]; // string
|
||||
r = 0; //error
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/inferSetterParamType.ts(13,9): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/compiler/inferSetterParamType.ts(13,9): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
return 0; // should be an error - can't coerce infered return type to match setter annotated type
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
set bar(n:string) {
|
||||
~~~
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(7,11): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(9,15): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(7,11): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(9,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(15,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(17,19): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(17,19): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322
|
||||
}
|
||||
logLength(42); // error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
let z;
|
||||
z = logLength(42); // no error; T is inferred as `any`
|
||||
~~
|
||||
!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
function logFirstLength<T extends string[], U extends string>(arg: { [K in U]: T }[U]): T {
|
||||
console.log(arg[0].length);
|
||||
@@ -30,7 +30,7 @@ tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322
|
||||
let zz = [];
|
||||
zz.push(logLength(42)); // no error; T is inferred as `any`
|
||||
~~
|
||||
!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
zz = logFirstLength([42]); // no error; T is inferred as `any[]`
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(4,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts (2 errors) ====
|
||||
@@ -8,8 +8,8 @@ tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error
|
||||
}
|
||||
f({ x: [null] }, { x: [1] }).x[0] = "" // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
f({ x: [1] }, { x: [null] }).x[0] = "" // was error TS2011: Cannot convert 'string' to 'number'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '""' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/salsa/a.js(14,13): error TS7008: Member 'inMethodNullable' implicitly has an 'any' type.
|
||||
tests/cases/conformance/salsa/a.js(20,9): error TS2322: Type '"string"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(39,9): error TS2322: Type 'false' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(20,9): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(39,9): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/salsa/a.js(93,13): error TS2334: 'this' cannot be referenced in a static property initializer.
|
||||
tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be referenced in a static property initializer.
|
||||
|
||||
@@ -29,7 +29,7 @@ tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be refere
|
||||
}
|
||||
this.inMultiple = "string";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '"string"' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
this.inMultipleMethods = "string";
|
||||
|
||||
var action = () => {
|
||||
@@ -50,7 +50,7 @@ tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be refere
|
||||
}
|
||||
this.inMultiple = false;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
this.inMultipleMethods = false;
|
||||
}
|
||||
set() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams.ts(13,17): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams.ts(13,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inheritedConstructorWithRestParams.ts (2 errors) ====
|
||||
@@ -17,7 +17,7 @@ tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345:
|
||||
// Errors
|
||||
new Derived("", 3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived(3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams2.ts(32,13): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams2.ts(32,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams2.ts(33,1): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error.
|
||||
Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error.
|
||||
Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,1): error TS2769: No overload matches this call.
|
||||
Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error.
|
||||
Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error.
|
||||
Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inheritedConstructorWithRestParams2.ts (3 errors) ====
|
||||
@@ -45,18 +45,18 @@ tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,1): error TS2769:
|
||||
// Errors
|
||||
new Derived(3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived("", 3, "", 3);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error.
|
||||
!!! error TS2769: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error.
|
||||
!!! error TS2769: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived("", 3, "", "");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2769: No overload matches this call.
|
||||
!!! error TS2769: Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error.
|
||||
!!! error TS2769: Argument of type '""' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
!!! error TS2769: Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error.
|
||||
!!! error TS2769: Argument of type '3' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type '10' is not assignable to type 'string'.
|
||||
tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts (1 errors) ====
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type
|
||||
// otherwise, there's a bug in overload resolution / partial typechecking
|
||||
var k: string = 10;
|
||||
~
|
||||
!!! error TS2322: Type '10' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user