mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #31414 from dhruvrajvanshi/master
Report error on method name for chained method calls
This commit is contained in:
+20
-5
@@ -21412,7 +21412,8 @@ namespace ts {
|
||||
reorderCandidates(signatures, candidates);
|
||||
if (!candidates.length) {
|
||||
if (reportErrors) {
|
||||
diagnostics.add(createDiagnosticForNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
||||
const errorNode = getCallErrorNode(node);
|
||||
diagnostics.add(createDiagnosticForNode(errorNode, Diagnostics.Call_target_does_not_contain_any_signatures));
|
||||
}
|
||||
return resolveErrorCall(node);
|
||||
}
|
||||
@@ -21490,11 +21491,13 @@ namespace ts {
|
||||
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
||||
// skip the checkApplicableSignature check.
|
||||
if (reportErrors) {
|
||||
const errorNode = getCallErrorNode(node);
|
||||
|
||||
if (candidateForArgumentError) {
|
||||
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, CheckMode.Normal, /*reportErrors*/ true);
|
||||
}
|
||||
else if (candidateForArgumentArityError) {
|
||||
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args));
|
||||
diagnostics.add(getArgumentArityError(errorNode, [candidateForArgumentArityError], args));
|
||||
}
|
||||
else if (candidateForTypeArgumentError) {
|
||||
checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, fallbackError);
|
||||
@@ -21502,19 +21505,31 @@ namespace ts {
|
||||
else {
|
||||
const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments));
|
||||
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
||||
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!));
|
||||
diagnostics.add(getTypeArgumentArityError(errorNode, signatures, typeArguments!));
|
||||
}
|
||||
else if (!isDecorator) {
|
||||
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args));
|
||||
diagnostics.add(getArgumentArityError(errorNode, signaturesWithCorrectTypeArgumentArity, args));
|
||||
}
|
||||
else if (fallbackError) {
|
||||
diagnostics.add(createDiagnosticForNode(node, fallbackError));
|
||||
diagnostics.add(createDiagnosticForNode(errorNode, fallbackError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
|
||||
|
||||
function getCallErrorNode(node: CallLikeExpression): Node {
|
||||
if (isCallExpression(node)) {
|
||||
if (isPropertyAccessExpression(node.expression)) {
|
||||
return node.expression.name;
|
||||
}
|
||||
else {
|
||||
return node.expression;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
|
||||
candidateForArgumentError = undefined;
|
||||
candidateForArgumentArityError = undefined;
|
||||
|
||||
@@ -8,12 +8,12 @@ tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts(7,1): error TS2554:
|
||||
function bar(a, b, [c]): void {}
|
||||
|
||||
foo("", 0);
|
||||
~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6211 tests/cases/compiler/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 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:3:20: An argument matching this binding pattern was not provided.
|
||||
|
||||
@@ -30,7 +30,7 @@ tests/cases/compiler/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 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
|
||||
~~~~
|
||||
|
||||
@@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided.
|
||||
@@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts:1:14: An argument for 'a' was not provided.
|
||||
+2
-2
@@ -29,12 +29,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok - needs number
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/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 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided.
|
||||
+2
-2
@@ -23,12 +23,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): e
|
||||
}
|
||||
foo(10);
|
||||
foo(); // not ok
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/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 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided.
|
||||
@@ -19,7 +19,7 @@ tests/cases/conformance/expressions/functionCalls/callOverload.ts(11,10): error
|
||||
!!! 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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,6): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,10): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,8): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(35,31): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(36,35): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(37,33): error TS2554: Expected 1 arguments, but got 0.
|
||||
@@ -28,19 +28,19 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
|
||||
|
||||
declare const xAny: X<any>;
|
||||
xAny.f() // error, any still expects an argument
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
|
||||
|
||||
@@ -56,15 +56,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,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 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
|
||||
|
||||
@@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
|
||||
a(4, "hello"); // ok
|
||||
a(4, "hello", void 0); // ok
|
||||
a(4); // not ok
|
||||
~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:42:23: An argument for 'y' was not provided.
|
||||
|
||||
@@ -88,15 +88,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
|
||||
|
||||
b(4, "hello", void 0, 2); // ok
|
||||
b(4, "hello"); // not ok
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 4 arguments, but got 2.
|
||||
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/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 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:23: An argument for 'y' was not provided.
|
||||
|
||||
@@ -117,7 +117,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y) // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:73:5: An argument for 'args' was not provided.
|
||||
call((x: number, y: number) => x + y, 4, 2) // ok
|
||||
|
||||
@@ -38,7 +38,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '
|
||||
class Sql extends Wagon {
|
||||
constructor() {
|
||||
super(); // error: not enough arguments
|
||||
~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/salsa/first.js:5:16: An argument for 'numberOxen' was not provided.
|
||||
this.foonly = 12
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,3): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
|
||||
==== tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts (1 errors) ====
|
||||
@@ -15,6 +15,6 @@ tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): erro
|
||||
|
||||
var y: MyClass = new MyClass();
|
||||
y.myMethod(); // error
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts:5:14: An argument for 'myList' was not provided.
|
||||
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3'
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1-3 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1'
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -11,7 +11,7 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1'
|
||||
foo('foo');
|
||||
foo('foo', 'bar');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -11,7 +11,7 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1'
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided.
|
||||
foo(1, 'bar');
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/functionCall18.ts(4,1): error TS2554: Expected 2 arguments,
|
||||
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 tests/cases/compiler/functionCall18.ts:2:31: An argument for 'b' was not provided.
|
||||
|
||||
@@ -13,7 +13,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments,
|
||||
~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall6.ts:1:14: An argument for 'a' was not provided.
|
||||
|
||||
@@ -15,7 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments,
|
||||
~
|
||||
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'.
|
||||
foo();
|
||||
~~~~~
|
||||
~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/functionCall7.ts:2:14: An argument for 'a' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads29.ts(4,9): error TS2554: Expected 1 argum
|
||||
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 tests/cases/compiler/functionOverloads29.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads34.ts(4,9): error TS2554: Expected 1 argum
|
||||
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 tests/cases/compiler/functionOverloads34.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads37.ts(4,9): error TS2554: Expected 1 argum
|
||||
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 tests/cases/compiler/functionOverloads37.ts:1:14: An argument for 'bar' was not provided.
|
||||
|
||||
@@ -11,11 +11,11 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp
|
||||
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 tests/cases/compiler/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);
|
||||
~
|
||||
@@ -26,13 +26,13 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp
|
||||
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);
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,1): error TS2554: Expected 1-3 arguments, but got 0.
|
||||
tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,7): error TS2554: Expected 1-3 arguments, but got 0.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts (1 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,1): error TS25
|
||||
var utils: Utils;
|
||||
|
||||
utils.fold(); // error
|
||||
~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-3 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts:2:15: An argument for 'c' was not provided.
|
||||
utils.fold(null); // no error
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArity.ts(8,45): error TS2554: Expe
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! 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);
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,45): error TS2554
|
||||
...args: TS): void;
|
||||
|
||||
call((x: number, y: number) => x + y);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! 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);
|
||||
|
||||
@@ -87,7 +87,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345
|
||||
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 tests/cases/conformance/types/rest/genericRestParameters3.ts:27:39: An argument for 'cb' was not provided.
|
||||
foo<CoolArray<any>>(100); // Error
|
||||
|
||||
@@ -4,5 +4,5 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,1): error
|
||||
==== tests/cases/conformance/es6/destructuring/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 @@ tests/cases/compiler/bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2.
|
||||
|
||||
==== tests/cases/compiler/bar.ts (3 errors) ====
|
||||
f(); // Error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/foo.js:6:12: An argument for 'a' was not provided.
|
||||
f(1); // Error
|
||||
~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/compiler/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 tests/cases/compiler/foo.js:6:18: An argument for 'c' was not provided.
|
||||
|
||||
|
||||
@@ -15,15 +15,15 @@ tests/cases/conformance/jsdoc/a.js(13,1): error TS2554: Expected 1 arguments, bu
|
||||
}
|
||||
|
||||
f() // should error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:1:21: An argument for '0' was not provided.
|
||||
g() // should error
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:5:12: An argument for 's' was not provided.
|
||||
h()
|
||||
~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:8:12: An argument for 's' was not provided.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/methodChainError.ts(9,6): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
|
||||
==== tests/cases/compiler/methodChainError.ts (1 errors) ====
|
||||
class Builder {
|
||||
method(param: string): Builder {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
new Builder()
|
||||
.method("a")
|
||||
.method();
|
||||
~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/methodChainError.ts:2:12: An argument for 'param' was not provided.
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [methodChainError.ts]
|
||||
class Builder {
|
||||
method(param: string): Builder {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
new Builder()
|
||||
.method("a")
|
||||
.method();
|
||||
|
||||
//// [methodChainError.js]
|
||||
var Builder = /** @class */ (function () {
|
||||
function Builder() {
|
||||
}
|
||||
Builder.prototype.method = function (param) {
|
||||
return this;
|
||||
};
|
||||
return Builder;
|
||||
}());
|
||||
new Builder()
|
||||
.method("a")
|
||||
.method();
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/methodChainError.ts ===
|
||||
class Builder {
|
||||
>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0))
|
||||
|
||||
method(param: string): Builder {
|
||||
>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15))
|
||||
>param : Symbol(param, Decl(methodChainError.ts, 1, 11))
|
||||
>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0))
|
||||
|
||||
return this;
|
||||
>this : Symbol(Builder, Decl(methodChainError.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
|
||||
new Builder()
|
||||
>new Builder() .method("a") .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15))
|
||||
>new Builder() .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15))
|
||||
>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0))
|
||||
|
||||
.method("a")
|
||||
>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15))
|
||||
|
||||
.method();
|
||||
>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15))
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/methodChainError.ts ===
|
||||
class Builder {
|
||||
>Builder : Builder
|
||||
|
||||
method(param: string): Builder {
|
||||
>method : (param: string) => Builder
|
||||
>param : string
|
||||
|
||||
return this;
|
||||
>this : this
|
||||
}
|
||||
}
|
||||
|
||||
new Builder()
|
||||
>new Builder() .method("a") .method() : Builder
|
||||
>new Builder() .method("a") .method : (param: string) => Builder
|
||||
>new Builder() .method("a") : Builder
|
||||
>new Builder() .method : (param: string) => Builder
|
||||
>new Builder() : Builder
|
||||
>Builder : typeof Builder
|
||||
|
||||
.method("a")
|
||||
>method : (param: string) => Builder
|
||||
>"a" : "a"
|
||||
|
||||
.method();
|
||||
>method : (param: string) => Builder
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/salsa/a.js(4,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/conformance/salsa/a.js(4,6): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
|
||||
==== tests/cases/conformance/salsa/a.js (1 errors) ====
|
||||
@@ -6,7 +6,7 @@ tests/cases/conformance/salsa/a.js(4,1): error TS2554: Expected 1 arguments, but
|
||||
var mod1 = require('./mod1')
|
||||
mod1()
|
||||
mod1.f() // error, not enough arguments
|
||||
~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 /.src/tests/cases/conformance/salsa/mod1.js:4:30: An argument for 'a' was not provided.
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ tests/cases/compiler/optionalParamArgsTest.ts(98,11): error TS2554: Expected 0 a
|
||||
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(102,6): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/compiler/optionalParamArgsTest.ts(103,6): 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,13): error TS2554: Expected 1 arguments, but got 2.
|
||||
@@ -16,8 +16,8 @@ tests/cases/compiler/optionalParamArgsTest.ts(110,15): error TS2554: Expected 0-
|
||||
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(114,6): error TS2554: Expected 1-2 arguments, but got 0.
|
||||
tests/cases/compiler/optionalParamArgsTest.ts(115,6): 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.
|
||||
tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 arguments, but got 0.
|
||||
|
||||
@@ -137,19 +137,19 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2
|
||||
~
|
||||
!!! error TS2554: Expected 0 arguments, but got 1.
|
||||
c1o1.C1M2();
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:23:17: An argument for 'C1M2A1' was not provided.
|
||||
i1o1.C1M2();
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:11:10: An argument for 'C1M2A1' was not provided.
|
||||
F2();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:45:13: An argument for 'F2A1' was not provided.
|
||||
L2();
|
||||
~~~~
|
||||
~~
|
||||
!!! 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);
|
||||
@@ -177,19 +177,19 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2
|
||||
~
|
||||
!!! error TS2554: Expected 0-2 arguments, but got 3.
|
||||
c1o1.C1M4();
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:29:17: An argument for 'C1M4A1' was not provided.
|
||||
i1o1.C1M4();
|
||||
~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:13:10: An argument for 'C1M4A1' was not provided.
|
||||
F4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:47:13: An argument for 'F4A1' was not provided.
|
||||
L4();
|
||||
~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:52:20: An argument for 'L4A1' was not provided.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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,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(32,5): 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'.
|
||||
|
||||
@@ -45,7 +45,7 @@ tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is n
|
||||
~
|
||||
!!! 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 tests/cases/compiler/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 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554:
|
||||
|
||||
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 tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts:8:31: An argument for 'arg' was not provided.
|
||||
|
||||
@@ -14,7 +14,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec
|
||||
f4(0, 1, 2);
|
||||
|
||||
f1(0, 1);
|
||||
~~~~~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
!!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:23: An argument for 'c' was not provided.
|
||||
f2(0, 1);
|
||||
@@ -22,7 +22,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec
|
||||
f4(0, 1);
|
||||
|
||||
f1(0);
|
||||
~~~~~
|
||||
~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:16: An argument for 'b' was not provided.
|
||||
f2(0);
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/restParamsWithNonRestParams.ts(4,1): error TS2555: Expected
|
||||
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 tests/cases/compiler/restParamsWithNonRestParams.ts:3:15: An argument for 'a' was not provided.
|
||||
function foo3(a?:string, ...b:number[]){}
|
||||
|
||||
@@ -10,6 +10,6 @@ tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): err
|
||||
): any;
|
||||
|
||||
call(function* (a: 'a') { }); // error, 2nd argument required
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts:3:5: An argument for 'args' was not provided.
|
||||
@@ -1,5 +1,5 @@
|
||||
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(17,15): 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,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]'.
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345:
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/functions/strictBindCallApply1.ts(41,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'.
|
||||
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(48,17): 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,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'.
|
||||
@@ -19,7 +19,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322:
|
||||
tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'.
|
||||
tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'.
|
||||
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(65,3): 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,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]'.
|
||||
@@ -47,7 +47,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
|
||||
|
||||
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
|
||||
~~
|
||||
@@ -97,7 +97,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
|
||||
|
||||
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
|
||||
~~
|
||||
@@ -132,7 +132,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345:
|
||||
|
||||
C.call(c, 10, "hello");
|
||||
C.call(c, 10); // Error
|
||||
~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 2.
|
||||
C.call(c, 10, 20); // Error
|
||||
~~
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): er
|
||||
Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
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(65,4): 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,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; }'.
|
||||
@@ -18,16 +18,16 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): err
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
|
||||
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(72,3): 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,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(75,3): 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,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(78,3): 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,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(81,3): 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,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'.
|
||||
@@ -182,7 +182,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
|
||||
!!! error TS2322: 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 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided.
|
||||
ok.f('wrong type');
|
||||
@@ -204,7 +204,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
|
||||
|
||||
let c = new C();
|
||||
c.explicitC(); // not enough arguments
|
||||
~~~~~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided.
|
||||
c.explicitC('wrong type');
|
||||
@@ -214,7 +214,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.explicitThis(); // not enough arguments
|
||||
~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided.
|
||||
c.explicitThis('wrong type 2');
|
||||
@@ -224,7 +224,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.implicitThis(); // not enough arguments
|
||||
~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided.
|
||||
c.implicitThis('wrong type 2');
|
||||
@@ -234,7 +234,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 2.
|
||||
c.explicitProperty(); // not enough arguments
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided.
|
||||
c.explicitProperty('wrong type 3');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/typeAssertionToGenericFunctionType.ts(5,13): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,1): error TS2554: Expected 1 arguments, but got 0.
|
||||
tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,3): error TS2554: Expected 1 arguments, but got 0.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeAssertionToGenericFunctionType.ts (2 errors) ====
|
||||
@@ -11,6 +11,6 @@ tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,1): error TS2554: E
|
||||
~
|
||||
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
|
||||
x.b<string>(); // error
|
||||
~~~~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/compiler/typeAssertionToGenericFunctionType.ts:3:12: An argument for 'x' was not provided.
|
||||
@@ -50,7 +50,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||
unionOfDifferentReturnType1(); // error missing parameter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:12:37: An argument for 'a' was not provided.
|
||||
|
||||
@@ -62,13 +62,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'.
|
||||
unionOfDifferentParameterTypes();// error - no call signatures
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/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 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:23:44: An argument for 'a' was not provided.
|
||||
unionOfDifferentNumberOfSignatures(10); // error - no call signatures
|
||||
@@ -78,11 +78,11 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
|
||||
var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ;
|
||||
unionWithDifferentParameterCount();// needs more args
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/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 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:28:80: An argument for 'b' was not provided.
|
||||
unionWithDifferentParameterCount("hello", 10);// OK
|
||||
@@ -94,13 +94,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter1(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/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 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:87: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature
|
||||
@@ -108,7 +108,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter2(); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:76: An argument for 'a' was not provided.
|
||||
|
||||
@@ -119,7 +119,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithOptionalParameter3(); // needs more args
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:45:37: An argument for 'a' was not provided.
|
||||
|
||||
@@ -131,13 +131,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithRestParameter1(); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2555: Expected at least 1 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/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 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:87: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithRestParameter2('hello', 10); // error no call signature
|
||||
@@ -148,7 +148,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
strOrNum = unionWithRestParameter2(); // error no call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 0.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:76: An argument for 'a' was not provided.
|
||||
|
||||
@@ -160,13 +160,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' 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 tests/cases/conformance/types/union/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 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:72:76: An argument for 'b' was not provided.
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,18): error TS
|
||||
|
||||
var f12345: F1 | F2 | F3 | F4 | F5;
|
||||
f12345("a"); // error
|
||||
~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2554: Expected 2 arguments, but got 1.
|
||||
!!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures4.ts:5:23: An argument for 'b' was not provided.
|
||||
f12345("a", "b");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Builder {
|
||||
method(param: string): Builder {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
new Builder()
|
||||
.method("a")
|
||||
.method();
|
||||
Reference in New Issue
Block a user