Giving too many arguments should error on the first argument that exceeds arity (#27982)

* span on first arg that exceeds arity

* refactor baseline

* handle cases for spread arguments

* refactor + add coverage for tuple spread cases

* create diagnostic on NodeArray of exceeding args

* test function overloading
This commit is contained in:
Collins Abitekaniza
2019-03-12 15:57:12 -07:00
committed by Wesley Wigham
parent ab8153602a
commit 7b55d1846b
58 changed files with 515 additions and 182 deletions
+30 -8
View File
@@ -20526,7 +20526,13 @@ namespace ts {
argCount--;
}
let spanArray: NodeArray<Node>;
let related: DiagnosticWithLocation | undefined;
const error = hasRestParameter || hasSpreadArgument ? hasRestParameter && hasSpreadArgument ? Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 :
Diagnostics.Expected_0_arguments_but_got_1_or_more : Diagnostics.Expected_0_arguments_but_got_1;
if (closestSignature && getMinArgumentCount(closestSignature) > argCount && closestSignature.declaration) {
const paramDecl = closestSignature.declaration.parameters[closestSignature.thisParameter ? argCount + 1 : argCount];
if (paramDecl) {
@@ -20537,17 +20543,33 @@ namespace ts {
);
}
}
if (hasRestParameter || hasSpreadArgument) {
const error = hasRestParameter && hasSpreadArgument ? Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 :
Diagnostics.Expected_0_arguments_but_got_1_or_more;
const diagnostic = createDiagnosticForNode(node, error, paramRange, argCount);
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
}
if (min < argCount && argCount < max) {
return createDiagnosticForNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount);
}
const diagnostic = createDiagnosticForNode(node, Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount);
if (!hasSpreadArgument && argCount < min) {
const diagnostic = createDiagnosticForNode(node, error, paramRange, argCount);
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
}
if (hasRestParameter || hasSpreadArgument) {
spanArray = createNodeArray(args);
if (hasSpreadArgument && argCount) {
const nextArg = elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
spanArray = createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
}
}
else {
spanArray = createNodeArray(args.slice(max));
}
spanArray.pos = first(spanArray).pos;
spanArray.end = last(spanArray).end;
if (spanArray.end === spanArray.pos) {
spanArray.end++;
}
const diagnostic = createDiagnosticForNodeArray(
getSourceFileOfNode(node), spanArray, error, paramRange, argCount);
return related ? addRelatedInfo(diagnostic, related) : diagnostic;
}
@@ -1,4 +1,4 @@
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2554: Expected 0 arguments, but got 1.
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,26): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (1 errors) ====
@@ -9,5 +9,5 @@ tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2554: Expect
}
(new C)[Symbol.iterator](0) // Should error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -6,7 +6,7 @@ tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals ar
tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name 'BigInt'.
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ESNext.
tests/cases/compiler/bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'.
tests/cases/compiler/bigintWithoutLib.ts(11,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/bigintWithoutLib.ts(11,32): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/bigintWithoutLib.ts(15,18): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(16,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
@@ -73,7 +73,7 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
!!! error TS2322: Type 'Object' is not assignable to type 'bigint'.
let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {}
@@ -1,8 +1,8 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(3,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(5,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(5,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(8,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(10,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(12,5): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(10,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(12,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2554: Expected 1 arguments, but got 0.
@@ -14,7 +14,7 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
else {
@@ -23,11 +23,11 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
foo();
}
@@ -1,8 +1,8 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(3,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(5,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(5,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(8,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(10,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(12,5): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(10,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(12,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error TS2554: Expected 1 arguments, but got 0.
@@ -14,7 +14,7 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
else {
@@ -23,11 +23,11 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T
!!! error TS2393: Duplicate function implementation.
foo();
foo(10);// not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
foo();
}
@@ -1,7 +1,7 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(6,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(6,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(11,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(11,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected 1 arguments, but got 0.
@@ -15,7 +15,7 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
else {
@@ -24,7 +24,7 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
foo(10);
@@ -1,5 +1,5 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(6,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(11,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(6,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(11,13): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(14,5): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): error TS2554: Expected 1 arguments, but got 0.
@@ -11,14 +11,14 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): e
function foo() { }
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
else {
function foo() { }
foo();
foo(10); // not ok
~~~~~~~
~~
!!! error TS2554: Expected 0 arguments, but got 1.
}
foo(10);
@@ -1,6 +1,6 @@
tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier 'D'.
tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'.
tests/cases/compiler/callOnInstance.ts(7,19): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/callOnInstance.ts(7,25): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures.
@@ -16,7 +16,7 @@ tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an exp
var s1: string = D(); // OK
var s2: string = (new D(1))();
~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
declare class C { constructor(value: number); }
@@ -0,0 +1,28 @@
tests/cases/conformance/expressions/functionCalls/callOverload.ts(7,7): error TS2554: Expected 1 arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/callOverload.ts(8,15): error TS2554: Expected 2 arguments, but got 4.
tests/cases/conformance/expressions/functionCalls/callOverload.ts(10,1): error TS2555: Expected at least 1 arguments, but got 0.
tests/cases/conformance/expressions/functionCalls/callOverload.ts(11,10): error TS2557: Expected at least 1 arguments, but got 0 or more.
==== tests/cases/conformance/expressions/functionCalls/callOverload.ts (4 errors) ====
declare function fn(x: any): void;
declare function takeTwo(x: any, y: any): void;
declare function withRest(a: any, ...args: Array<any>): void;
var n: number[];
fn(1) // no error
fn(1, 2, 3, 4)
~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 4.
takeTwo(1, 2, 3, 4)
~~~~
!!! error TS2554: Expected 2 arguments, but got 4.
withRest('a', ...n); // no error
withRest();
~~~~~~~~~~
!!! error TS2555: Expected at least 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callOverload.ts:3:27: An argument for 'a' was not provided.
withRest(...n);
~~~~
!!! error TS2557: Expected at least 1 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callOverload.ts:3:27: An argument for 'a' was not provided.
+21
View File
@@ -0,0 +1,21 @@
//// [callOverload.ts]
declare function fn(x: any): void;
declare function takeTwo(x: any, y: any): void;
declare function withRest(a: any, ...args: Array<any>): void;
var n: number[];
fn(1) // no error
fn(1, 2, 3, 4)
takeTwo(1, 2, 3, 4)
withRest('a', ...n); // no error
withRest();
withRest(...n);
//// [callOverload.js]
var n;
fn(1); // no error
fn(1, 2, 3, 4);
takeTwo(1, 2, 3, 4);
withRest.apply(void 0, ['a'].concat(n)); // no error
withRest();
withRest.apply(void 0, n);
@@ -0,0 +1,39 @@
=== tests/cases/conformance/expressions/functionCalls/callOverload.ts ===
declare function fn(x: any): void;
>fn : Symbol(fn, Decl(callOverload.ts, 0, 0))
>x : Symbol(x, Decl(callOverload.ts, 0, 20))
declare function takeTwo(x: any, y: any): void;
>takeTwo : Symbol(takeTwo, Decl(callOverload.ts, 0, 34))
>x : Symbol(x, Decl(callOverload.ts, 1, 25))
>y : Symbol(y, Decl(callOverload.ts, 1, 32))
declare function withRest(a: any, ...args: Array<any>): void;
>withRest : Symbol(withRest, Decl(callOverload.ts, 1, 47))
>a : Symbol(a, Decl(callOverload.ts, 2, 26))
>args : Symbol(args, Decl(callOverload.ts, 2, 33))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var n: number[];
>n : Symbol(n, Decl(callOverload.ts, 3, 3))
fn(1) // no error
>fn : Symbol(fn, Decl(callOverload.ts, 0, 0))
fn(1, 2, 3, 4)
>fn : Symbol(fn, Decl(callOverload.ts, 0, 0))
takeTwo(1, 2, 3, 4)
>takeTwo : Symbol(takeTwo, Decl(callOverload.ts, 0, 34))
withRest('a', ...n); // no error
>withRest : Symbol(withRest, Decl(callOverload.ts, 1, 47))
>n : Symbol(n, Decl(callOverload.ts, 3, 3))
withRest();
>withRest : Symbol(withRest, Decl(callOverload.ts, 1, 47))
withRest(...n);
>withRest : Symbol(withRest, Decl(callOverload.ts, 1, 47))
>n : Symbol(n, Decl(callOverload.ts, 3, 3))
@@ -0,0 +1,56 @@
=== tests/cases/conformance/expressions/functionCalls/callOverload.ts ===
declare function fn(x: any): void;
>fn : (x: any) => void
>x : any
declare function takeTwo(x: any, y: any): void;
>takeTwo : (x: any, y: any) => void
>x : any
>y : any
declare function withRest(a: any, ...args: Array<any>): void;
>withRest : (a: any, ...args: any[]) => void
>a : any
>args : any[]
var n: number[];
>n : number[]
fn(1) // no error
>fn(1) : void
>fn : (x: any) => void
>1 : 1
fn(1, 2, 3, 4)
>fn(1, 2, 3, 4) : void
>fn : (x: any) => void
>1 : 1
>2 : 2
>3 : 3
>4 : 4
takeTwo(1, 2, 3, 4)
>takeTwo(1, 2, 3, 4) : void
>takeTwo : (x: any, y: any) => void
>1 : 1
>2 : 2
>3 : 3
>4 : 4
withRest('a', ...n); // no error
>withRest('a', ...n) : void
>withRest : (a: any, ...args: any[]) => void
>'a' : "a"
>...n : number
>n : number[]
withRest();
>withRest() : void
>withRest : (a: any, ...args: any[]) => void
withRest(...n);
>withRest(...n) : void
>withRest : (a: any, ...args: any[]) => void
>...n : number
>n : number[]
@@ -1,7 +1,7 @@
tests/cases/compiler/callOverloads1.ts(1,7): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads1.ts(9,10): error TS2300: Duplicate identifier 'Foo'.
tests/cases/compiler/callOverloads1.ts(9,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads1.ts(13,10): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/callOverloads1.ts(13,18): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/compiler/callOverloads1.ts (4 errors) ====
@@ -24,7 +24,7 @@ tests/cases/compiler/callOverloads1.ts(13,10): error TS2554: Expected 0 argument
function F1(a:any) { return a;}
var f1 = new Foo("hey");
~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -4,7 +4,7 @@ tests/cases/compiler/callOverloads2.ts(11,10): error TS2389: Function implementa
tests/cases/compiler/callOverloads2.ts(11,10): error TS2393: Duplicate function implementation.
tests/cases/compiler/callOverloads2.ts(12,10): error TS2393: Duplicate function implementation.
tests/cases/compiler/callOverloads2.ts(14,10): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/compiler/callOverloads2.ts(18,10): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/callOverloads2.ts(18,18): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/compiler/callOverloads2.ts (7 errors) ====
@@ -38,7 +38,7 @@ tests/cases/compiler/callOverloads2.ts(18,10): error TS2554: Expected 0 argument
declare function Gar(s:String); // expect no error
var f1 = new Foo("hey");
~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -1,5 +1,5 @@
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(22,1): error TS2556: Expected 1 arguments, but got 2 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(23,1): error TS2556: Expected 0 arguments, but got 1 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(22,13): error TS2556: Expected 1 arguments, but got 2 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(23,7): error TS2556: Expected 0 arguments, but got 1 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(26,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(27,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
@@ -9,8 +9,8 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(29,13): err
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(30,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(31,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,1): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,1): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,8): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,8): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
@@ -37,10 +37,10 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): erro
// extra arguments
normal("g", ...ns)
~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2556: Expected 1 arguments, but got 2 or more.
thunk(...ns)
~~~~~~~~~~~~
~~~~~
!!! error TS2556: Expected 0 arguments, but got 1 or more.
// bad
@@ -66,11 +66,11 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): erro
~~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
prefix(...ns) // required parameters are required
~~~~~~~~~~~~~
~~~~~
!!! error TS2556: Expected 1-3 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts:3:25: An argument for 's' was not provided.
prefix(...mixed)
~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2556: Expected 1-3 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts:3:25: An argument for 's' was not provided.
prefix(...tuple)
@@ -0,0 +1,32 @@
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(5,14): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(6,19): error TS2554: Expected 2 arguments, but got 5.
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(7,19): error TS2556: Expected 2 arguments, but got 4 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(8,19): error TS2556: Expected 2 arguments, but got 5 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(9,16): error TS2556: Expected 2 arguments, but got 1 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts(10,9): error TS2554: Expected 2 arguments, but got 3.
==== tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts (6 errors) ====
declare function takeTwo(a: string, b: string): void;
declare const t2: [string, string];
declare const t3: [string, string, string];
takeTwo('a', ...t2); // error on ...t2
~~~~~
!!! error TS2554: Expected 2 arguments, but got 3.
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
~~~~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 5.
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
~~~~~~~~~~
!!! error TS2556: Expected 2 arguments, but got 4 or more.
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
~~~~~~~~~~~~~~~
!!! error TS2556: Expected 2 arguments, but got 5 or more.
takeTwo(...t2, 'a'); // error on 'a'
~~~
!!! error TS2556: Expected 2 arguments, but got 1 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts:1:37: An argument for 'b' was not provided.
takeTwo(...t3); // error on ...t3
~~~~~
!!! error TS2554: Expected 2 arguments, but got 3.
@@ -0,0 +1,19 @@
//// [callWithSpread3.ts]
declare function takeTwo(a: string, b: string): void;
declare const t2: [string, string];
declare const t3: [string, string, string];
takeTwo('a', ...t2); // error on ...t2
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
takeTwo(...t2, 'a'); // error on 'a'
takeTwo(...t3); // error on ...t3
//// [callWithSpread3.js]
takeTwo.apply(void 0, ['a'].concat(t2)); // error on ...t2
takeTwo.apply(void 0, ['a', 'b', 'c'].concat(t2)); // error on 'c' and ...t2
takeTwo.apply(void 0, ['a', 'b'].concat(t2, ['c'])); // error on ...t2 and 'c'
takeTwo.apply(void 0, ['a', 'b', 'c'].concat(t2, ['d'])); // error on 'c', ...t2 and 'd'
takeTwo.apply(void 0, t2.concat(['a'])); // error on 'a'
takeTwo.apply(void 0, t3); // error on ...t3
@@ -0,0 +1,36 @@
=== tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts ===
declare function takeTwo(a: string, b: string): void;
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>a : Symbol(a, Decl(callWithSpread3.ts, 0, 25))
>b : Symbol(b, Decl(callWithSpread3.ts, 0, 35))
declare const t2: [string, string];
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
declare const t3: [string, string, string];
>t3 : Symbol(t3, Decl(callWithSpread3.ts, 2, 13))
takeTwo('a', ...t2); // error on ...t2
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
takeTwo(...t2, 'a'); // error on 'a'
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t2 : Symbol(t2, Decl(callWithSpread3.ts, 1, 13))
takeTwo(...t3); // error on ...t3
>takeTwo : Symbol(takeTwo, Decl(callWithSpread3.ts, 0, 0))
>t3 : Symbol(t3, Decl(callWithSpread3.ts, 2, 13))
@@ -0,0 +1,60 @@
=== tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts ===
declare function takeTwo(a: string, b: string): void;
>takeTwo : (a: string, b: string) => void
>a : string
>b : string
declare const t2: [string, string];
>t2 : [string, string]
declare const t3: [string, string, string];
>t3 : [string, string, string]
takeTwo('a', ...t2); // error on ...t2
>takeTwo('a', ...t2) : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>...t2 : string
>t2 : [string, string]
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
>takeTwo('a', 'b', 'c', ...t2) : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>'c' : "c"
>...t2 : string
>t2 : [string, string]
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
>takeTwo('a', 'b', ...t2, 'c') : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>...t2 : string
>t2 : [string, string]
>'c' : "c"
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
>takeTwo('a', 'b', 'c', ...t2, 'd') : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>'c' : "c"
>...t2 : string
>t2 : [string, string]
>'d' : "d"
takeTwo(...t2, 'a'); // error on 'a'
>takeTwo(...t2, 'a') : void
>takeTwo : (a: string, b: string) => void
>...t2 : string
>t2 : [string, string]
>'a' : "a"
takeTwo(...t3); // error on ...t3
>takeTwo(...t3) : void
>takeTwo : (a: string, b: string) => void
>...t3 : string
>t3 : [string, string, string]
@@ -1,5 +1,5 @@
tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(7,10): error TS2554: Expected 0 arguments, but got 1.
tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(15,10): error TS2554: Expected 0 arguments, but got 1.
tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(7,16): error TS2554: Expected 0 arguments, but got 1.
tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts(15,16): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/classWithoutExplicitConstructor.ts (2 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/cl
var c = new C();
var c2 = new C(null); // error
~~~~~~~~~~~
~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
class D<T extends Date> {
@@ -20,5 +20,5 @@ tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/cl
var d = new D();
var d2 = new D(null); // error
~~~~~~~~~~~
~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -1,5 +1,5 @@
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(1,7): error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,2): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,10): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (2 errors) ====
@@ -9,6 +9,6 @@ tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,2): erro
{
}
(new S18(123)).S18 = 0;
~~~~~~~~~~~~
~~~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -1,17 +1,17 @@
tests/cases/compiler/couldNotSelectGenericOverload.ts(3,11): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/couldNotSelectGenericOverload.ts(7,11): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/couldNotSelectGenericOverload.ts(3,24): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/couldNotSelectGenericOverload.ts(7,25): error TS2554: Expected 1 arguments, but got 2.
==== tests/cases/compiler/couldNotSelectGenericOverload.ts (2 errors) ====
function makeArray<T>(items: T[]): T[] { return items; }
var b = [1, ""];
var b1G = makeArray(1, ""); // any, no error
~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 1 arguments, but got 2.
var b2G = makeArray(b); // any[]
function makeArray2(items: any[]): any[] { return items; }
var b3G = makeArray2(1, ""); // error
~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 1 arguments, but got 2.
@@ -1,6 +1,6 @@
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(6,1): error TS2554: Expected 1-2 arguments, but got 3.
tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 arguments, but got 3.
==== tests/cases/compiler/functionCall11.ts (3 errors) ====
@@ -15,6 +15,6 @@ tests/cases/compiler/functionCall11.ts(6,1): error TS2554: Expected 1-2 argument
~
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
foo('foo', 1, 'bar');
~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 1-2 arguments, but got 3.
@@ -1,5 +1,5 @@
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(4,1): error TS2554: Expected 1 arguments, but got 2.
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.
@@ -10,7 +10,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments,
~
!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string'.
foo('foo', 'bar');
~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
foo();
~~~~~
@@ -1,4 +1,4 @@
tests/cases/compiler/functionCall7.ts(5,1): error TS2554: Expected 1 arguments, but got 2.
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(7,1): error TS2554: Expected 1 arguments, but got 0.
@@ -9,7 +9,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments,
var myC = new m1.c1();
foo(myC);
foo(myC, myC);
~~~~~~~~~~~~~
~~~
!!! error TS2554: Expected 1 arguments, but got 2.
foo(4);
~
@@ -1,4 +1,4 @@
tests/cases/compiler/functionCall8.ts(3,1): error TS2554: Expected 0-1 arguments, but got 2.
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'.
@@ -6,7 +6,7 @@ tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type '4' i
function foo(a?:string){}
foo('foo');
foo('foo', 'bar');
~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 0-1 arguments, but got 2.
foo(4);
~
@@ -1,5 +1,5 @@
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(5,1): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/functionCall9.ts(5,15): error TS2554: Expected 0-2 arguments, but got 3.
==== tests/cases/compiler/functionCall9.ts (2 errors) ====
@@ -10,6 +10,6 @@ tests/cases/compiler/functionCall9.ts(5,1): error TS2554: Expected 0-2 arguments
~~~~~
!!! error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'.
foo('foo', 1, 'bar');
~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 0-2 arguments, but got 3.
foo();
@@ -1,7 +1,7 @@
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(19,3): error TS2554: Expected 1 arguments, but got 4.
tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,9): error TS2554: Expected 1 arguments, but got 4.
==== tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts (4 errors) ====
@@ -30,6 +30,6 @@ tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,3): error TS255
~~
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'never'.
a("", "", "", ""); // Error
~~~~~~~~~~~~~~~~~
~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 4.
}
@@ -1,6 +1,6 @@
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(6,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2554: Expected 1 arguments, but got 2.
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'.
Type 'Function' provides no match for the signature '(x: string): string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
@@ -33,10 +33,10 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
~
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Function'.
foo(() => { }, 1);
~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1 arguments, but got 2.
foo(1, () => { });
~~~~~~~~~~~~~~~~~
~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
function foo2<T extends (x: string) => string>(x: T): T { return x; }
@@ -1,10 +1,10 @@
tests/cases/compiler/functionParameterArityMismatch.ts(3,1): error TS2554: Expected 1-3 arguments, but got 0.
tests/cases/compiler/functionParameterArityMismatch.ts(4,1): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(5,1): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/compiler/functionParameterArityMismatch.ts(5,13): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/compiler/functionParameterArityMismatch.ts(11,1): error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(12,1): error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(13,1): error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(14,1): error TS2554: Expected 0-6 arguments, but got 7.
tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Expected 0-6 arguments, but got 7.
==== tests/cases/compiler/functionParameterArityMismatch.ts (7 errors) ====
@@ -18,7 +18,7 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,1): error TS2554: Expe
~~~~~~~~
!!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
f1(1, 2, 3, 4);
~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1-3 arguments, but got 4.
declare function f2();
@@ -35,6 +35,6 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,1): error TS2554: Expe
~~~~~~~~~~~~~~~~~
!!! error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments.
f2(1, 2, 3, 4, 5, 6, 7);
~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 0-6 arguments, but got 7.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/rest/genericRestArity.ts(7,1): error TS2554: Expected 3 arguments, but got 1.
tests/cases/conformance/types/rest/genericRestArity.ts(8,1): error TS2554: Expected 3 arguments, but got 8.
tests/cases/conformance/types/rest/genericRestArity.ts(8,45): error TS2554: Expected 3 arguments, but got 8.
==== tests/cases/conformance/types/rest/genericRestArity.ts (2 errors) ====
@@ -14,6 +14,6 @@ tests/cases/conformance/types/rest/genericRestArity.ts(8,1): error TS2554: Expec
!!! error TS2554: Expected 3 arguments, but got 1.
!!! related TS6210 tests/cases/conformance/types/rest/genericRestArity.ts:5:5: An argument for 'args' was not provided.
call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~
!!! error TS2554: Expected 3 arguments, but got 8.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/rest/genericRestArityStrict.ts(7,1): error TS2554: Expected 3 arguments, but got 1.
tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,1): error TS2554: Expected 3 arguments, but got 8.
tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,45): error TS2554: Expected 3 arguments, but got 8.
==== tests/cases/conformance/types/rest/genericRestArityStrict.ts (2 errors) ====
@@ -14,6 +14,6 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,1): error TS2554:
!!! error TS2554: Expected 3 arguments, but got 1.
!!! related TS6210 tests/cases/conformance/types/rest/genericRestArityStrict.ts:5:5: An argument for 'args' was not provided.
call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~
!!! error TS2554: Expected 3 arguments, but got 8.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/rest/genericRestParameters1.ts(22,1): error TS2556: Expected 3 arguments, but got 1 or more.
tests/cases/conformance/types/rest/genericRestParameters1.ts(31,1): error TS2556: Expected 3 arguments, but got 1 or more.
tests/cases/conformance/types/rest/genericRestParameters1.ts(22,11): error TS2556: Expected 3 arguments, but got 1 or more.
tests/cases/conformance/types/rest/genericRestParameters1.ts(31,11): error TS2556: Expected 3 arguments, but got 1 or more.
tests/cases/conformance/types/rest/genericRestParameters1.ts(135,23): error TS2344: Type 'Function' does not satisfy the constraint '(...args: any) => any'.
Type 'Function' provides no match for the signature '(...args: any): any'.
tests/cases/conformance/types/rest/genericRestParameters1.ts(164,1): error TS2322: Type '(a: never) => void' is not assignable to type '(...args: any[]) => void'.
@@ -30,7 +30,7 @@ tests/cases/conformance/types/rest/genericRestParameters1.ts(164,1): error TS232
f1(42, "hello", true, ...t0);
f1(ns[0], ns[1], true);
f1(...ns, true); // Error, tuple spread only expanded when last
~~~~~~~~~~~~~~~
~~~~
!!! error TS2556: Expected 3 arguments, but got 1 or more.
f2(42, "hello", true);
@@ -41,7 +41,7 @@ tests/cases/conformance/types/rest/genericRestParameters1.ts(164,1): error TS232
f2(42, "hello", true, ...t0);
f2(ns[0], ns[1], true);
f2(...ns, true); // Error, tuple spread only expanded when last
~~~~~~~~~~~~~~~
~~~~
!!! error TS2556: Expected 3 arguments, but got 1 or more.
!!! related TS6210 tests/cases/conformance/types/rest/genericRestParameters1.ts:2:30: An argument for 'x1' was not provided.
@@ -1,5 +1,5 @@
tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(8,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(9,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(8,10): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(9,10): error TS2554: Expected 1 arguments, but got 2.
==== tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts (2 errors) ====
@@ -11,10 +11,10 @@ tests/cases/conformance/expressions/functionCalls/grammarAmbiguities.ts(9,1): er
f(g<A, B>(7));
f(g < A, B > 7); // Should error
~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
f(g < A, B > +(7)); // Should error
~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
@@ -1,9 +1,9 @@
tests/cases/compiler/grammarAmbiguities1.ts(8,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
tests/cases/compiler/grammarAmbiguities1.ts(9,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2554: Expected 1 arguments, but got 2.
==== tests/cases/compiler/grammarAmbiguities1.ts (6 errors) ====
@@ -15,17 +15,17 @@ tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' ca
f(g<A, B>(7));
f(g < A, B > 7);
~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
f(g < A, B > +(7));
~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
f(g < A, B > +(7));
~~~~~
!!! error TS2365: Operator '<' cannot be applied to types '<T, U>(x: any) => any' and 'typeof A'.
~~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'.
~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(15,1): error TS2556: Expected 1 arguments, but got 0 or more.
tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(15,5): error TS2556: Expected 1 arguments, but got 0 or more.
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts (1 errors) ====
@@ -17,6 +17,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(15,1): error TS2556:
}
foo(...new SymbolIterator);
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2556: Expected 1 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts:1:14: An argument for 's' was not provided.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(15,1): error TS2556: Expected 1 arguments, but got 0 or more.
tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(15,5): error TS2556: Expected 1 arguments, but got 0 or more.
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts (1 errors) ====
@@ -17,6 +17,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(15,1): error TS2556
}
foo(...new SymbolIterator);
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2556: Expected 1 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts:1:17: An argument for 's' was not provided.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(15,1): error TS2556: Expected 1 arguments, but got 0 or more.
tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(15,5): error TS2556: Expected 1 arguments, but got 0 or more.
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts (1 errors) ====
@@ -17,6 +17,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(15,1): error TS2556:
}
foo(...new SymbolIterator);
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2556: Expected 1 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts:1:14: An argument for 's' was not provided.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(15,1): error TS2557: Expected at least 1 arguments, but got 0 or more.
tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(15,5): error TS2557: Expected at least 1 arguments, but got 0 or more.
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts (1 errors) ====
@@ -17,6 +17,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(15,1): error TS2557:
}
foo(...new SymbolIterator);
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2557: Expected at least 1 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts:1:14: An argument for 's1' was not provided.
@@ -3,7 +3,7 @@ tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(4,15): error TS8020
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(4,32): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(7,20): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(10,18): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(11,12): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(11,18): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(13,14): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(14,11): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(15,8): error TS8020: JSDoc types can only be used inside documentation comments.
@@ -38,7 +38,7 @@ tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(22,17): error TS802
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8020: JSDoc types can only be used inside documentation comments.
return f(12, 'hullo');
~~~~~~~~~~~~~~
~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
}
var whatevs: * = 1001;
@@ -1,21 +1,21 @@
tests/cases/compiler/optionalParamArgsTest.ts(31,12): error TS2393: Duplicate function implementation.
tests/cases/compiler/optionalParamArgsTest.ts(34,12): error TS2393: Duplicate function implementation.
tests/cases/compiler/optionalParamArgsTest.ts(98,1): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(99,1): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(100,1): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(101,1): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(98,11): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(99,11): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(100,4): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(101,4): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/optionalParamArgsTest.ts(102,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(103,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(104,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(105,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(106,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(107,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(108,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(109,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(110,1): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(111,1): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(112,1): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(113,1): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(106,13): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(107,13): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(108,6): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(109,6): error TS2554: Expected 1 arguments, but got 2.
tests/cases/compiler/optionalParamArgsTest.ts(110,15): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(111,15): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(112,8): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(113,8): error TS2554: Expected 0-2 arguments, but got 3.
tests/cases/compiler/optionalParamArgsTest.ts(114,1): error TS2554: Expected 1-2 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(115,1): error TS2554: Expected 1-2 arguments, but got 0.
tests/cases/compiler/optionalParamArgsTest.ts(116,1): error TS2554: Expected 1-2 arguments, but got 0.
@@ -125,16 +125,16 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2
// Negative tests - we expect these cases to fail
c1o1.C1M1(1);
~~~~~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
i1o1.C1M1(1);
~~~~~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
F1(1);
~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
L1(1);
~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
c1o1.C1M2();
~~~~~~~~~~~
@@ -153,28 +153,28 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:50:20: An argument for 'L2A1' was not provided.
c1o1.C1M2(1,2);
~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1 arguments, but got 2.
i1o1.C1M2(1,2);
~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1 arguments, but got 2.
F2(1,2);
~~~~~~~
~
!!! error TS2554: Expected 1 arguments, but got 2.
L2(1,2);
~~~~~~~
~
!!! error TS2554: Expected 1 arguments, but got 2.
c1o1.C1M3(1,2,3);
~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 0-2 arguments, but got 3.
i1o1.C1M3(1,2,3);
~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 0-2 arguments, but got 3.
F3(1,2,3);
~~~~~~~~~
~
!!! error TS2554: Expected 0-2 arguments, but got 3.
L3(1,2,3);
~~~~~~~~~
~
!!! error TS2554: Expected 0-2 arguments, but got 3.
c1o1.C1M4();
~~~~~~~~~~~
@@ -1,6 +1,6 @@
tests/cases/compiler/overload1.ts(27,5): error TS2322: Type 'C' is not assignable to type 'string'.
tests/cases/compiler/overload1.ts(29,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/overload1.ts(31,3): error TS2554: Expected 1-2 arguments, but got 3.
tests/cases/compiler/overload1.ts(31,11): error TS2554: Expected 1-2 arguments, but got 3.
tests/cases/compiler/overload1.ts(32,3): error TS2554: Expected 1-2 arguments, but got 0.
tests/cases/compiler/overload1.ts(33,1): error TS2322: Type 'C' is not assignable to type 'string'.
tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is not assignable to parameter of type 'string'.
@@ -42,7 +42,7 @@ tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is n
!!! error TS2322: Type 'number' is not assignable to type 'string'.
var z:string=x.g(x.g(3,3)); // good
z=x.g(2,2,2); // no match
~~~~~~~~~~
~
!!! error TS2554: Expected 1-2 arguments, but got 3.
z=x.g(); // no match
~~~~~
@@ -1,11 +1,11 @@
tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts(3,16): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts(3,24): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/compiler/overloadResolutionOnDefaultConstructor1.ts (1 errors) ====
class Bar {
public clone() {
return new Bar(0);
~~~~~~~~~~
~
!!! error TS2554: Expected 0 arguments, but got 1.
}
}
@@ -1,10 +1,9 @@
tests/cases/conformance/parser/ecmascript5/parserNoASIOnCallAfterFunctionExpression1.ts(1,9): error TS2554: Expected 0 arguments, but got 1.
tests/cases/conformance/parser/ecmascript5/parserNoASIOnCallAfterFunctionExpression1.ts(2,2): error TS2554: Expected 0 arguments, but got 1.
==== tests/cases/conformance/parser/ecmascript5/parserNoASIOnCallAfterFunctionExpression1.ts (1 errors) ====
var x = function () { }
~~~~~~~~~~~~~~~
(<any>window).foo;
~~~~~~~~~~~~~
~~~~~~~~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(8,5): error TS2556: Expected 2 arguments, but got 0 or more.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(20,5): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(8,8): error TS2556: Expected 2 arguments, but got 0 or more.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(20,15): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(25,5): error TS2542: Index signature in type 'readonly string[]' only permits reading.
@@ -12,7 +12,7 @@ tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(25,5): erro
function f1(...args: readonly string[]) {
f0(...args); // Error
~~~~~~~~~~~
~~~~~~~
!!! error TS2556: Expected 2 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts:1:13: An argument for 'a' was not provided.
f1('abc', 'def');
@@ -27,7 +27,7 @@ tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(25,5): erro
f1(...args);
f2('abc', 'def');
f2('abc', ...args); // Error
~~~~~~~~~~~~~~~~~~
~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 3.
f2(...args);
}
@@ -8,9 +8,9 @@ tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() =>
tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type '3' is not assignable to parameter of type '(t: typeof g) => void'.
tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type '3' is not assignable to type '() => any'.
tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: This overload signature is not compatible with its implementation signature.
tests/cases/compiler/recursiveFunctionTypes.ts(33,1): error TS2554: Expected 0-1 arguments, but got 2.
tests/cases/compiler/recursiveFunctionTypes.ts(33,8): error TS2554: Expected 0-1 arguments, but got 2.
tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type '""' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'.
tests/cases/compiler/recursiveFunctionTypes.ts(42,1): error TS2554: Expected 0-1 arguments, but got 2.
tests/cases/compiler/recursiveFunctionTypes.ts(42,8): error TS2554: Expected 0-1 arguments, but got 2.
tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of type '""' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'.
@@ -68,7 +68,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of
function f6(a?: any) { return f6; }
f6("", 3); // error (arity mismatch)
~~~~~~~~~
~
!!! error TS2554: Expected 0-1 arguments, but got 2.
f6(""); // ok (function takes an any param)
~~
@@ -81,7 +81,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of
declare function f7(a?: typeof f7): typeof f7;
f7("", 3); // error (arity mismatch)
~~~~~~~~~
~
!!! error TS2554: Expected 0-1 arguments, but got 2.
f7(""); // ok (function takes an any param)
~~
@@ -1,7 +1,7 @@
tests/cases/conformance/functions/strictBindCallApply1.ts(11,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(17,11): error TS2554: Expected 3 arguments, but got 2.
tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(19,11): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(19,44): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'.
Property '1' is missing in type '[number]' but required in type '[number, string]'.
tests/cases/conformance/functions/strictBindCallApply1.ts(23,37): error TS2322: Type 'number' is not assignable to type 'string'.
@@ -12,7 +12,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(41,29): error TS2345:
tests/cases/conformance/functions/strictBindCallApply1.ts(42,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'.
tests/cases/conformance/functions/strictBindCallApply1.ts(48,11): error TS2554: Expected 3 arguments, but got 2.
tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(50,11): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(50,38): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'.
tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'.
tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'.
@@ -21,7 +21,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345:
tests/cases/conformance/functions/strictBindCallApply1.ts(62,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(65,1): error TS2554: Expected 3 arguments, but got 2.
tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(67,1): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(67,24): error TS2554: Expected 3 arguments, but got 4.
tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'.
tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'.
@@ -53,7 +53,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
~~
!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
let c03 = foo.call(undefined, 10, "hello", 30); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 3 arguments, but got 4.
let a00 = foo.apply(undefined, [10, "hello"]);
@@ -103,7 +103,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
~~
!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
let c13 = c.foo.call(c, 10, "hello", 30); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 3 arguments, but got 4.
let c14 = c.foo.call(undefined, 10, "hello"); // Error
~~~~~~~~~
@@ -138,7 +138,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
~~
!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
C.call(c, 10, "hello", 30); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 3 arguments, but got 4.
C.apply(c, [10, "hello"]);
@@ -4,9 +4,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4.
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (8 errors) ====
@@ -36,7 +36,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
~~
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
var f = foo([], 1, 2, 3); // any (with error)
~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1-3 arguments, but got 4.
var u = foo ``; // number
@@ -47,6 +47,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
var y = foo `${1}${"2"}`; // {}
var z = foo `${1}${2}${3}`; // any (with error)
~~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1-3 arguments, but got 4.
@@ -4,9 +4,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(14,9): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(19,20): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,9): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4.
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts (8 errors) ====
@@ -36,7 +36,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
~~
!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'.
var f = foo([], 1, 2, 3); // any (with error)
~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1-3 arguments, but got 4.
var u = foo ``; // number
@@ -47,6 +47,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
var y = foo `${1}${"2"}`; // {}
var z = foo `${1}${2}${3}`; // any (with error)
~~~~~~~~~~~~~~~~~~
~
!!! error TS2554: Expected 1-3 arguments, but got 4.
@@ -1,7 +1,7 @@
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,1): error TS2554: Expected 3 arguments, but got 4.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,24): error TS1109: Expression expected.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,27): error TS1109: Expression expected.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,28): error TS1005: '}' expected.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,28): error TS2554: Expected 3 arguments, but got 4.
==== tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts (4 errors) ====
@@ -10,11 +10,11 @@ tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions4.ts(5,28):
// Incomplete call, but too many parameters.
f `123qdawdrqw${ 1 }${ }${
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 3 arguments, but got 4.
~
!!! error TS1109: Expression expected.
!!! error TS1109: Expression expected.
!!! error TS1005: '}' expected.
!!! error TS1005: '}' expected.
!!! error TS2554: Expected 3 arguments, but got 4.
@@ -1,6 +1,6 @@
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts(5,1): error TS2554: Expected 3 arguments, but got 4.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts(5,29): error TS1109: Expression expected.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts(5,30): error TS1005: '}' expected.
tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts(5,30): error TS2554: Expected 3 arguments, but got 4.
==== tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts (3 errors) ====
@@ -9,9 +9,9 @@ tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions5.ts(5,30):
// Incomplete call, but too many parameters.
f `123qdawdrqw${ 1 }${ 2 }${
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 3 arguments, but got 4.
!!! error TS1109: Expression expected.
!!! error TS1005: '}' expected.
!!! error TS1005: '}' expected.
!!! error TS2554: Expected 3 arguments, but got 4.
@@ -12,7 +12,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): e
Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,10): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
Types of property 'y' are incompatible.
Type 'string' is not assignable to type 'number'.
@@ -20,16 +20,16 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): err
Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' but required in type '{ y: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,17): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,20): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,20): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,24): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
The 'this' types of each signature are incompatible.
Type 'void' is not assignable to type '{ y: number; }'.
@@ -189,7 +189,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
ok.f(13, 'too many arguments');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
wrongPropertyType.f(13);
~~~~~~~~~~~~~~~~~
@@ -211,7 +211,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
c.explicitC(13, 'too many arguments');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
c.explicitThis(); // not enough arguments
~~~~~~~~~~~~~~~~
@@ -221,7 +221,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
c.explicitThis(14, 'too many arguments 2');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
c.implicitThis(); // not enough arguments
~~~~~~~~~~~~~~~~
@@ -231,7 +231,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
c.implicitThis(14, 'too many arguments 2');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
c.explicitProperty(); // not enough arguments
~~~~~~~~~~~~~~~~~~~~
@@ -241,7 +241,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'.
c.explicitProperty(15, 'too many arguments 3');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
@@ -21,7 +21,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(49,12): error TS2
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(55,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(56,12): error TS2555: Expected at least 1 arguments, but got 0.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(59,12): error TS2554: Expected 2 arguments, but got 1.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(61,12): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(61,49): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(62,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(63,12): error TS2554: Expected 2 arguments, but got 0.
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
@@ -146,7 +146,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:87: An argument for 'b' was not provided.
strOrNum = unionWithRestParameter2('hello', 10); // error no call signature
strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 2 arguments, but got 3.
strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature
~~~~~~~
@@ -1,5 +1,5 @@
tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(23,1): error TS2554: Expected 2 arguments, but got 1.
tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,1): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,18): error TS2554: Expected 2 arguments, but got 3.
==== tests/cases/conformance/types/union/unionTypeCallSignatures4.ts (2 errors) ====
@@ -31,6 +31,6 @@ tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,1): error TS2
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures4.ts:5:23: An argument for 'b' was not provided.
f12345("a", "b");
f12345("a", "b", "c"); // error
~~~~~~~~~~~~~~~~~~~~~
~~~
!!! error TS2554: Expected 2 arguments, but got 3.
@@ -21,7 +21,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(49,12): erro
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(55,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(56,12): error TS2555: Expected at least 1 arguments, but got 0.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(59,12): error TS2554: Expected 2 arguments, but got 1.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,12): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,53): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(63,12): error TS2554: Expected 2 arguments, but got 0.
tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
@@ -145,7 +145,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro
!!! related TS6210 tests/cases/conformance/types/union/unionTypeConstructSignatures.ts:58:95: An argument for 'b' was not provided.
strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature
strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
!!! error TS2554: Expected 2 arguments, but got 3.
strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature
~~~~~~~
@@ -0,0 +1,11 @@
declare function fn(x: any): void;
declare function takeTwo(x: any, y: any): void;
declare function withRest(a: any, ...args: Array<any>): void;
var n: number[];
fn(1) // no error
fn(1, 2, 3, 4)
takeTwo(1, 2, 3, 4)
withRest('a', ...n); // no error
withRest();
withRest(...n);
@@ -0,0 +1,10 @@
declare function takeTwo(a: string, b: string): void;
declare const t2: [string, string];
declare const t3: [string, string, string];
takeTwo('a', ...t2); // error on ...t2
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
takeTwo(...t2, 'a'); // error on 'a'
takeTwo(...t3); // error on ...t3
@@ -1,7 +1,7 @@
/// <reference path="fourslash.ts"/>
////var x = [1, 2, 3];
////var /*y*/y = /*1*/x.pop(5)/*2*/;
////var /*y*/y = x.pop(/*1*/5/*2*/);
////
verify.errorExistsBetweenMarkers("1", "2");