mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Report arity errors on call target nodes (#54443)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
co-authored by
Nathan Shively-Sanders
parent
68b9b07264
commit
e9737b893c
+3
-15
@@ -33922,21 +33922,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
|
||||
function getDiagnosticSpanForCallNode(node: CallExpression, doNotIncludeArguments?: boolean) {
|
||||
let start: number;
|
||||
let length: number;
|
||||
function getDiagnosticSpanForCallNode(node: CallExpression) {
|
||||
const sourceFile = getSourceFileOfNode(node);
|
||||
|
||||
if (isPropertyAccessExpression(node.expression)) {
|
||||
const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name);
|
||||
start = nameSpan.start;
|
||||
length = doNotIncludeArguments ? nameSpan.length : node.end - start;
|
||||
}
|
||||
else {
|
||||
const expressionSpan = getErrorSpanForNode(sourceFile, node.expression);
|
||||
start = expressionSpan.start;
|
||||
length = doNotIncludeArguments ? expressionSpan.length : node.end - start;
|
||||
}
|
||||
const { start, length } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression);
|
||||
return { start, length, sourceFile };
|
||||
}
|
||||
|
||||
@@ -34915,7 +34903,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo));
|
||||
}
|
||||
if (isCallExpression(errorTarget.parent)) {
|
||||
const { start, length } = getDiagnosticSpanForCallNode(errorTarget.parent, /*doNotIncludeArguments*/ true);
|
||||
const { start, length } = getDiagnosticSpanForCallNode(errorTarget.parent);
|
||||
diagnostic.start = start;
|
||||
diagnostic.length = length;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ arityErrorRelatedSpanBindingPattern.ts(7,1): error TS2554: Expected 3 arguments,
|
||||
function bar(a, b, [c]): void {}
|
||||
|
||||
foo("", 0);
|
||||
~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6211 arityErrorRelatedSpanBindingPattern.ts:1:20: An argument matching this binding pattern was not provided.
|
||||
|
||||
bar("", 0);
|
||||
~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6211 arityErrorRelatedSpanBindingPattern.ts:3:20: An argument matching this binding pattern was not provided.
|
||||
|
||||
@@ -30,7 +30,7 @@ baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
|
||||
}
|
||||
|
||||
class D extends C { constructor(public z: number) { super(this.z) } } // too few params
|
||||
~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 baseCheck.ts:1:34: An argument for 'y' was not provided.
|
||||
~~~~
|
||||
|
||||
@@ -33,6 +33,6 @@ blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2554: Expected 1 arg
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided.
|
||||
@@ -33,6 +33,6 @@ blockScopedSameNameFunctionDeclarationES6.ts(16,1): error TS2554: Expected 1 arg
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationES6.ts:1:14: An argument for 'a' was not provided.
|
||||
+2
-2
@@ -29,12 +29,12 @@ blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided.
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided.
|
||||
+2
-2
@@ -23,12 +23,12 @@ blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): error TS2554: Expected
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided.
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided.
|
||||
@@ -19,7 +19,7 @@ callOverload.ts(11,10): error TS2556: A spread argument must either have a tuple
|
||||
!!! 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 callOverload.ts:3:27: An argument for 'a' was not provided.
|
||||
withRest(...n);
|
||||
|
||||
@@ -28,19 +28,19 @@ callWithMissingVoid.ts(75,1): error TS2554: Expected 3 arguments, but got 1.
|
||||
|
||||
declare const xAny: X<any>;
|
||||
xAny.f() // error, any still expects an argument
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
|
||||
|
||||
declare const xUnknown: X<unknown>;
|
||||
xUnknown.f() // error, unknown still expects an argument
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
|
||||
|
||||
declare const xNever: X<never>;
|
||||
xNever.f() // error, never still expects an argument
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
|
||||
|
||||
@@ -56,15 +56,15 @@ callWithMissingVoid.ts(75,1): error TS2554: Expected 3 arguments, but got 1.
|
||||
new MyPromise<void>(resolve => resolve()); // no error
|
||||
new MyPromise<void | number>(resolve => resolve()); // no error
|
||||
new MyPromise<any>(resolve => resolve()); // error, `any` arguments cannot be omitted
|
||||
~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
|
||||
new MyPromise<unknown>(resolve => resolve()); // error, `unknown` arguments cannot be omitted
|
||||
~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
|
||||
new MyPromise<never>(resolve => resolve()); // error, `never` arguments cannot be omitted
|
||||
~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
|
||||
|
||||
@@ -78,7 +78,7 @@ callWithMissingVoid.ts(75,1): error TS2554: Expected 3 arguments, but got 1.
|
||||
a(4, "hello"); // ok
|
||||
a(4, "hello", void 0); // ok
|
||||
a(4); // not ok
|
||||
~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 2-3 arguments, but got 1.
|
||||
!!! related TS6210 callWithMissingVoid.ts:42:23: An argument for 'y' was not provided.
|
||||
|
||||
@@ -88,15 +88,15 @@ callWithMissingVoid.ts(75,1): error TS2554: Expected 3 arguments, but got 1.
|
||||
|
||||
b(4, "hello", void 0, 2); // ok
|
||||
b(4, "hello"); // not ok
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 4 arguments, but got 2.
|
||||
!!! related TS6210 callWithMissingVoid.ts:50:34: An argument for 'z' was not provided.
|
||||
b(4, "hello", void 0); // not ok
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 4 arguments, but got 3.
|
||||
!!! related TS6210 callWithMissingVoid.ts:50:43: An argument for 'what' was not provided.
|
||||
b(4); // not ok
|
||||
~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 4 arguments, but got 1.
|
||||
!!! related TS6210 callWithMissingVoid.ts:50:23: An argument for 'y' was not provided.
|
||||
|
||||
@@ -117,7 +117,7 @@ callWithMissingVoid.ts(75,1): error TS2554: Expected 3 arguments, but got 1.
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y) // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6236 callWithMissingVoid.ts:73:5: Arguments for the rest parameter 'args' were not provided.
|
||||
call((x: number, y: number) => x + y, 4, 2) // ok
|
||||
|
||||
+6
-6
@@ -39,28 +39,28 @@ tsfile.ts(12,4): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
// no change in behavior
|
||||
f2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:2:21: An argument for 'p' was not provided.
|
||||
f3();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:3:21: An argument for 'p' was not provided.
|
||||
f4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:4:21: An argument for 'p' was not provided.
|
||||
|
||||
o2.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o3.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o4.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
|
||||
+12
-12
@@ -31,28 +31,28 @@ tsfile.ts(12,4): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
// new behavior: treat 'undefined', 'unknown', and 'any' as optional in non-strict mode
|
||||
f2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:2:21: An argument for 'p' was not provided.
|
||||
f3();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:3:21: An argument for 'p' was not provided.
|
||||
f4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:4:21: An argument for 'p' was not provided.
|
||||
|
||||
o2.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o3.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o4.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
|
||||
@@ -63,28 +63,28 @@ tsfile.ts(12,4): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
// no change in behavior
|
||||
f2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:2:21: An argument for 'p' was not provided.
|
||||
f3();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:3:21: An argument for 'p' was not provided.
|
||||
f4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:4:21: An argument for 'p' was not provided.
|
||||
|
||||
o2.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o3.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
o4.m();
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 defs.d.ts:6:20: An argument for 'p' was not provided.
|
||||
|
||||
@@ -39,7 +39,7 @@ second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to p
|
||||
class Sql extends Wagon {
|
||||
constructor() {
|
||||
super(); // error: not enough arguments
|
||||
~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 first.js:5:16: An argument for 'numberOxen' was not provided.
|
||||
this.foonly = 12
|
||||
|
||||
@@ -15,6 +15,6 @@ derivedTypeCallingBaseImplWithOptionalParams.ts(13,3): error TS2554: Expected 1
|
||||
|
||||
var y: MyClass = new MyClass();
|
||||
y.myMethod(); // error
|
||||
~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 derivedTypeCallingBaseImplWithOptionalParams.ts:5:14: An argument for 'myList' was not provided.
|
||||
@@ -3,6 +3,6 @@ es5DateAPIs.ts(1,6): error TS2554: Expected 2-7 arguments, but got 1.
|
||||
|
||||
==== es5DateAPIs.ts (1 errors) ====
|
||||
Date.UTC(2017); // should error
|
||||
~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 2-7 arguments, but got 1.
|
||||
!!! related TS6210 lib.es5.d.ts:--:--: An argument for 'monthIndex' was not provided.
|
||||
@@ -8,7 +8,7 @@ functionCall11.ts(6,15): error TS2554: Expected 1-2 arguments, but got 3.
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 functionCall11.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -8,7 +8,7 @@ functionCall12.ts(7,15): error TS2345: Argument of type 'number' is not assignab
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1-3 arguments, but got 0.
|
||||
!!! related TS6210 functionCall12.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -7,7 +7,7 @@ functionCall13.ts(5,5): error TS2345: Argument of type 'number' is not assignabl
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 functionCall13.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -11,7 +11,7 @@ functionCall16.ts(6,5): error TS2345: Argument of type 'number' is not assignabl
|
||||
foo('foo');
|
||||
foo('foo', 'bar');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 functionCall16.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -11,7 +11,7 @@ functionCall17.ts(6,12): error TS2345: Argument of type 'number' is not assignab
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 functionCall17.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -6,7 +6,7 @@ functionCall18.ts(4,1): error TS2554: Expected 2 arguments, but got 1.
|
||||
declare function foo<T>(a: T, b: T);
|
||||
declare function foo(a: {});
|
||||
foo<string>("hello");
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 functionCall18.ts:2:31: An argument for 'b' was not provided.
|
||||
|
||||
@@ -13,7 +13,7 @@ functionCall6.ts(5,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 functionCall6.ts:1:14: An argument for 'a' was not provided.
|
||||
|
||||
@@ -15,7 +15,7 @@ functionCall7.ts(7,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 functionCall7.ts:2:14: An argument for 'a' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ functionOverloads29.ts(4,9): error TS2554: Expected 1 arguments, but got 0.
|
||||
function foo(bar:number):number;
|
||||
function foo(bar:any):any{ return bar }
|
||||
var x = foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 functionOverloads29.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ functionOverloads34.ts(4,9): error TS2554: Expected 1 arguments, but got 0.
|
||||
function foo(bar:{a:boolean;}):number;
|
||||
function foo(bar:{a:any;}):any{ return bar }
|
||||
var x = foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 functionOverloads34.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ functionOverloads37.ts(4,9): error TS2554: Expected 1 arguments, but got 0.
|
||||
function foo(bar:{a:boolean;}[]):number;
|
||||
function foo(bar:{a:any;}[]):any{ return bar }
|
||||
var x = foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 functionOverloads37.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -12,11 +12,11 @@ functionParameterArityMismatch.ts(15,19): error TS2554: Expected 0-6 arguments,
|
||||
declare function f1(a: number);
|
||||
declare function f1(a: number, b: number, c: number);
|
||||
f1();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1-3 arguments, but got 0.
|
||||
!!! related TS6210 functionParameterArityMismatch.ts:1:21: An argument for 'a' was not provided.
|
||||
f1(1, 2);
|
||||
~~~~~~~~
|
||||
~~
|
||||
!!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
|
||||
f1(1, 2, 3, 4);
|
||||
~
|
||||
@@ -27,13 +27,13 @@ functionParameterArityMismatch.ts(15,19): error TS2554: Expected 0-6 arguments,
|
||||
declare function f2(a: number, b: number, c: number, d: number);
|
||||
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
|
||||
f2(1);
|
||||
~~~~~
|
||||
~~
|
||||
!!! error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments.
|
||||
f2(1, 2, 3);
|
||||
~~~~~~~~~~~
|
||||
~~
|
||||
!!! error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments.
|
||||
f2(1, 2, 3, 4, 5);
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~
|
||||
!!! 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);
|
||||
~
|
||||
|
||||
@@ -9,7 +9,7 @@ genericFunctionsWithOptionalParameters2.ts(7,7): error TS2554: Expected 1-3 argu
|
||||
var utils: Utils;
|
||||
|
||||
utils.fold(); // error
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-3 arguments, but got 0.
|
||||
!!! related TS6210 genericFunctionsWithOptionalParameters2.ts:2:15: An argument for 'c' was not provided.
|
||||
utils.fold(null); // no error
|
||||
|
||||
@@ -10,7 +10,7 @@ genericRestArity.ts(8,45): error TS2554: Expected 3 arguments, but got 8.
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6236 genericRestArity.ts:5:5: Arguments for the rest parameter 'args' were not provided.
|
||||
call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
@@ -10,7 +10,7 @@ genericRestArityStrict.ts(8,45): error TS2554: Expected 3 arguments, but got 8.
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6236 genericRestArityStrict.ts:5:5: Arguments for the rest parameter 'args' were not provided.
|
||||
call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
@@ -90,7 +90,7 @@ genericRestParameters3.ts(59,5): error TS2345: Argument of type '["what"]' is no
|
||||
declare function foo<T extends any[]>(cb: (...args: T) => void): void;
|
||||
|
||||
foo<CoolArray<any>>(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 genericRestParameters3.ts:33:39: An argument for 'cb' was not provided.
|
||||
foo<CoolArray<any>>(100); // Error
|
||||
|
||||
@@ -4,5 +4,5 @@ iterableArrayPattern25.ts(2,1): error TS2554: Expected 2 arguments, but got 1.
|
||||
==== iterableArrayPattern25.ts (1 errors) ====
|
||||
function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { }
|
||||
takeFirstTwoEntries(new Map([["", 0], ["hello", 1]]));
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
@@ -14,15 +14,15 @@ bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2.
|
||||
|
||||
==== bar.ts (3 errors) ====
|
||||
f(); // Error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 0.
|
||||
!!! related TS6210 foo.js:6:12: An argument for 'a' was not provided.
|
||||
f(1); // Error
|
||||
~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 foo.js:6:15: An argument for 'b' was not provided.
|
||||
f(1, 2); // Error
|
||||
~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6210 foo.js:6:18: An argument for 'c' was not provided.
|
||||
|
||||
|
||||
@@ -15,15 +15,15 @@ a.js(13,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
}
|
||||
|
||||
f() // should error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 a.js:1:21: An argument for '0' was not provided.
|
||||
g() // should error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 a.js:4:13: An argument for 's' was not provided.
|
||||
h()
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 a.js:7:14: An argument for 's' was not provided.
|
||||
|
||||
@@ -14,7 +14,7 @@ methodChainError.ts(16,6): error TS2349: This expression is not callable.
|
||||
new Builder()
|
||||
.method("a")
|
||||
.method()
|
||||
~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 methodChainError.ts:3:12: An argument for 'param' was not provided.
|
||||
.method("a");
|
||||
|
||||
@@ -6,7 +6,7 @@ a.js(4,6): error TS2554: Expected 1 arguments, but got 0.
|
||||
var mod1 = require('./mod1')
|
||||
mod1()
|
||||
mod1.f() // error, not enough arguments
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 mod1.js:4:30: An argument for 'a' was not provided.
|
||||
|
||||
|
||||
@@ -137,19 +137,19 @@ optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 arguments, but got 0
|
||||
~
|
||||
!!! error TS2554: Expected 0 arguments, but got 1.
|
||||
c1o1.C1M2();
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:23:17: An argument for 'C1M2A1' was not provided.
|
||||
i1o1.C1M2();
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:11:10: An argument for 'C1M2A1' was not provided.
|
||||
F2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:45:13: An argument for 'F2A1' was not provided.
|
||||
L2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:50:20: An argument for 'L2A1' was not provided.
|
||||
c1o1.C1M2(1,2);
|
||||
@@ -177,19 +177,19 @@ optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 arguments, but got 0
|
||||
~
|
||||
!!! error TS2554: Expected 0-2 arguments, but got 3.
|
||||
c1o1.C1M4();
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:29:17: An argument for 'C1M4A1' was not provided.
|
||||
i1o1.C1M4();
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:13:10: An argument for 'C1M4A1' was not provided.
|
||||
F4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:47:13: An argument for 'F4A1' was not provided.
|
||||
L4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 optionalParamArgsTest.ts:52:20: An argument for 'L4A1' was not provided.
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ overload1.ts(34,3): error TS2769: No overload matches this call.
|
||||
~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 3.
|
||||
z=x.g(); // no match
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 overload1.ts:17:11: An argument for 'n' was not provided.
|
||||
z=x.g(new O.B()); // ambiguous (up and down conversion)
|
||||
|
||||
@@ -17,7 +17,7 @@ overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: Expected 1 arguments,
|
||||
|
||||
declare function f<A, B = {}>(arg: number): void;
|
||||
f<number>(); // wrong number of arguments (#25683)
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 overloadsAndTypeArgumentArityErrors.ts:8:31: An argument for 'arg' was not provided.
|
||||
|
||||
@@ -13,7 +13,7 @@ privateNameMethod.ts(8,14): error TS2554: Expected 1 arguments, but got 0.
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
this.#method() // Error
|
||||
~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 privateNameMethod.ts:2:13: An argument for 'param' was not provided.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ privateNameStaticMethod.ts(8,12): error TS2554: Expected 1 arguments, but got 0.
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
A1.#method() // Error
|
||||
~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 privateNameStaticMethod.ts:2:20: An argument for 'param' was not provided.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ requiredInitializedParameter1.ts(16,1): error TS2554: Expected 3 arguments, but
|
||||
f4(0, 1, 2);
|
||||
|
||||
f1(0, 1);
|
||||
~~~~~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6210 requiredInitializedParameter1.ts:1:23: An argument for 'c' was not provided.
|
||||
f2(0, 1);
|
||||
@@ -22,7 +22,7 @@ requiredInitializedParameter1.ts(16,1): error TS2554: Expected 3 arguments, but
|
||||
f4(0, 1);
|
||||
|
||||
f1(0);
|
||||
~~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 requiredInitializedParameter1.ts:1:16: An argument for 'b' was not provided.
|
||||
f2(0);
|
||||
|
||||
@@ -6,7 +6,7 @@ restParamsWithNonRestParams.ts(4,1): error TS2555: Expected at least 1 arguments
|
||||
foo(); // ok
|
||||
function foo2(a:string, ...b:number[]){}
|
||||
foo2(); // should be an error
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 restParamsWithNonRestParams.ts:3:15: An argument for 'a' was not provided.
|
||||
function foo3(a?:string, ...b:number[]){}
|
||||
|
||||
@@ -14,7 +14,7 @@ simpleRecursionWithBaseCase1.ts(31,10): error TS7023: 'fn5' implicitly has retur
|
||||
}
|
||||
}
|
||||
const num: number = fn1();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 simpleRecursionWithBaseCase1.ts:1:14: An argument for 'n' was not provided.
|
||||
|
||||
@@ -22,7 +22,7 @@ simpleRecursionWithBaseCase1.ts(31,10): error TS7023: 'fn5' implicitly has retur
|
||||
return fn2(n);
|
||||
}
|
||||
const nev: never = fn2();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 simpleRecursionWithBaseCase1.ts:10:14: An argument for 'n' was not provided.
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): error TS2554: Expected 2
|
||||
): any;
|
||||
|
||||
call(function* (a: 'a') { }); // error, 2nd argument required
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6236 spreadOfParamsFromGeneratorMakesRequiredParams.ts:3:5: Arguments for the rest parameter 'args' were not provided.
|
||||
@@ -69,7 +69,7 @@ strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call.
|
||||
|
||||
let c00 = foo.call(undefined, 10, "hello");
|
||||
let c01 = foo.call(undefined, 10); // Error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
let c02 = foo.call(undefined, 10, 20); // Error
|
||||
~~
|
||||
@@ -122,7 +122,7 @@ strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call.
|
||||
|
||||
let c10 = c.foo.call(c, 10, "hello");
|
||||
let c11 = c.foo.call(c, 10); // Error
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
let c12 = c.foo.call(c, 10, 20); // Error
|
||||
~~
|
||||
@@ -159,7 +159,7 @@ strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call.
|
||||
|
||||
C.call(c, 10, "hello");
|
||||
C.call(c, 10); // Error
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
C.call(c, 10, 20); // Error
|
||||
~~
|
||||
|
||||
@@ -6,7 +6,7 @@ templateLiteralsInTypes.ts(3,8): error TS2339: Property 'foo' does not exist on
|
||||
const f = (hdr: string, val: number) => `${hdr}:\t${val}\r\n` as `${string}:\t${number}\r\n`;
|
||||
|
||||
f("x").foo;
|
||||
~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 templateLiteralsInTypes.ts:1:25: An argument for 'val' was not provided.
|
||||
~~~
|
||||
|
||||
@@ -174,7 +174,7 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h
|
||||
!!! error TS2353: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
|
||||
ok.f(); // not enough arguments
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided.
|
||||
ok.f('wrong type');
|
||||
@@ -196,7 +196,7 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h
|
||||
|
||||
let c = new C();
|
||||
c.explicitC(); // not enough arguments
|
||||
~~~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided.
|
||||
c.explicitC('wrong type');
|
||||
@@ -206,7 +206,7 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.explicitThis(); // not enough arguments
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided.
|
||||
c.explicitThis('wrong type 2');
|
||||
@@ -216,7 +216,7 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.implicitThis(); // not enough arguments
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided.
|
||||
c.implicitThis('wrong type 2');
|
||||
@@ -226,7 +226,7 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.explicitProperty(); // not enough arguments
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided.
|
||||
c.explicitProperty('wrong type 3');
|
||||
|
||||
@@ -11,6 +11,6 @@ typeAssertionToGenericFunctionType.ts(6,3): error TS2554: Expected 1 arguments,
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
x.b<string>(); // error
|
||||
~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 typeAssertionToGenericFunctionType.ts:3:12: An argument for 'x' was not provided.
|
||||
@@ -71,7 +71,7 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
!!! error TS2769: Overload 2 of 2, '(a: string): string | boolean', gave the following error.
|
||||
!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
unionOfDifferentReturnType1(); // error missing parameter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:12:37: An argument for 'a' was not provided.
|
||||
|
||||
@@ -83,13 +83,13 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
|
||||
unionOfDifferentParameterTypes();// error - no call signatures
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:18:40: An argument for 'a' was not provided.
|
||||
|
||||
var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; };
|
||||
unionOfDifferentNumberOfSignatures(); // error - no call signatures
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:23:44: An argument for 'a' was not provided.
|
||||
unionOfDifferentNumberOfSignatures(10); // error - no call signatures
|
||||
@@ -99,11 +99,11 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
|
||||
var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ;
|
||||
unionWithDifferentParameterCount();// needs more args
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:28:69: An argument for 'a' was not provided.
|
||||
unionWithDifferentParameterCount("hello");// needs more args
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:28:80: An argument for 'b' was not provided.
|
||||
unionWithDifferentParameterCount("hello", 10);// OK
|
||||
@@ -115,13 +115,13 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter1(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:33:37: An argument for 'a' was not provided.
|
||||
|
||||
var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number };
|
||||
strOrNum = unionWithOptionalParameter2('hello'); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:39:87: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature
|
||||
@@ -129,7 +129,7 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter2(); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:39:76: An argument for 'a' was not provided.
|
||||
|
||||
@@ -140,7 +140,7 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter3(); // needs more args
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:45:37: An argument for 'a' was not provided.
|
||||
|
||||
@@ -152,13 +152,13 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithRestParameter1(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:51:33: An argument for 'a' was not provided.
|
||||
|
||||
var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number };
|
||||
strOrNum = unionWithRestParameter2('hello'); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:58:87: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithRestParameter2('hello', 10); // error no call signature
|
||||
@@ -169,7 +169,7 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithRestParameter2(); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:58:76: An argument for 'a' was not provided.
|
||||
|
||||
@@ -181,13 +181,13 @@ unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithRestParameter3(); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:65:33: An argument for 'a' was not provided.
|
||||
|
||||
var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };
|
||||
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 unionTypeCallSignatures.ts:72:76: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
@@ -26,7 +26,7 @@ unionTypeCallSignatures4.ts(25,18): error TS2554: Expected 2 arguments, but got
|
||||
|
||||
var f12345: F1 | F2 | F3 | F4 | F5;
|
||||
f12345("a"); // error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 unionTypeCallSignatures4.ts:5:23: An argument for 'b' was not provided.
|
||||
f12345("a", "b");
|
||||
|
||||
@@ -35,7 +35,7 @@ unionTypeReduction2.ts(33,5): error TS2554: Expected 1 arguments, but got 0.
|
||||
function f6(x: (x: 'hello' | undefined) => void, y: (x?: string) => void) {
|
||||
let f = !!true ? x : y; // (x: 'hello' | undefined) => void
|
||||
f(); // Error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 unionTypeReduction2.ts:31:17: An argument for 'x' was not provided.
|
||||
f('hello');
|
||||
|
||||
@@ -101,7 +101,7 @@ variadicTuples1.ts(411,7): error TS2322: Type '[boolean, false]' is not assignab
|
||||
foo1(...t1, ...t2, 42, 43, 44);
|
||||
foo1(...t1, ...t2, ...a1);
|
||||
foo1(...t1); // Error
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2555: Expected at least 3 arguments, but got 2.
|
||||
!!! related TS6210 variadicTuples1.ts:45:45: An argument for 'c' was not provided.
|
||||
foo1(...t1, 45); // Error
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
////
|
||||
//// declare function f(x: string, y: number): any;
|
||||
////
|
||||
//// /*1*/f(/*2*/)/*3*/
|
||||
//// /*1*/f/*2*/(/*3*/)
|
||||
|
||||
goTo.marker("2");
|
||||
goTo.marker("3");
|
||||
verify.signatureHelp({
|
||||
triggerReason: {
|
||||
kind: "invoked"
|
||||
@@ -19,4 +19,4 @@ verify.signatureHelp({
|
||||
}
|
||||
})
|
||||
verify.not.codeFixAvailable() // trigger typecheck
|
||||
verify.errorExistsBetweenMarkers("1", "3");
|
||||
verify.errorExistsBetweenMarkers("1", "2");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
////
|
||||
//// declare function addListener<K extends keyof Events>(type: K, listener: (ev: Events[K]) => any): void;
|
||||
////
|
||||
//// /*1*/addListener("/*2*/")/*3*/
|
||||
//// /*1*/addListener/*2*/("/*3*/")
|
||||
|
||||
verify.completions({ marker: ["2"], exact: ["click", "drag"] });
|
||||
verify.errorExistsBetweenMarkers("1", "3");
|
||||
verify.completions({ marker: ["3"], exact: ["click", "drag"] });
|
||||
verify.errorExistsBetweenMarkers("1", "2");
|
||||
|
||||
Reference in New Issue
Block a user