Skip to content

Commit 2c458c0

Browse files
Merge pull request #31414 from dhruvrajvanshi/master
Report error on method name for chained method calls
2 parents 9d23ce3 + 9ca8045 commit 2c458c0

File tree

47 files changed

+230
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+230
-114
lines changed

src/compiler/checker.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21412,7 +21412,8 @@ namespace ts {
2141221412
reorderCandidates(signatures, candidates);
2141321413
if (!candidates.length) {
2141421414
if (reportErrors) {
21415-
diagnostics.add(createDiagnosticForNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
21415+
const errorNode = getCallErrorNode(node);
21416+
diagnostics.add(createDiagnosticForNode(errorNode, Diagnostics.Call_target_does_not_contain_any_signatures));
2141621417
}
2141721418
return resolveErrorCall(node);
2141821419
}
@@ -21490,31 +21491,45 @@ namespace ts {
2149021491
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
2149121492
// skip the checkApplicableSignature check.
2149221493
if (reportErrors) {
21494+
const errorNode = getCallErrorNode(node);
21495+
2149321496
if (candidateForArgumentError) {
2149421497
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, CheckMode.Normal, /*reportErrors*/ true);
2149521498
}
2149621499
else if (candidateForArgumentArityError) {
21497-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args));
21500+
diagnostics.add(getArgumentArityError(errorNode, [candidateForArgumentArityError], args));
2149821501
}
2149921502
else if (candidateForTypeArgumentError) {
2150021503
checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, fallbackError);
2150121504
}
2150221505
else {
2150321506
const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments));
2150421507
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
21505-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!));
21508+
diagnostics.add(getTypeArgumentArityError(errorNode, signatures, typeArguments!));
2150621509
}
2150721510
else if (!isDecorator) {
21508-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args));
21511+
diagnostics.add(getArgumentArityError(errorNode, signaturesWithCorrectTypeArgumentArity, args));
2150921512
}
2151021513
else if (fallbackError) {
21511-
diagnostics.add(createDiagnosticForNode(node, fallbackError));
21514+
diagnostics.add(createDiagnosticForNode(errorNode, fallbackError));
2151221515
}
2151321516
}
2151421517
}
2151521518

2151621519
return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
2151721520

21521+
function getCallErrorNode(node: CallLikeExpression): Node {
21522+
if (isCallExpression(node)) {
21523+
if (isPropertyAccessExpression(node.expression)) {
21524+
return node.expression.name;
21525+
}
21526+
else {
21527+
return node.expression;
21528+
}
21529+
}
21530+
return node;
21531+
}
21532+
2151821533
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
2151921534
candidateForArgumentError = undefined;
2152021535
candidateForArgumentArityError = undefined;

tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts(7,1): error TS2554:
88
function bar(a, b, [c]): void {}
99

1010
foo("", 0);
11-
~~~~~~~~~~
11+
~~~
1212
!!! error TS2554: Expected 3 arguments, but got 2.
1313
!!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:1:20: An argument matching this binding pattern was not provided.
1414

1515
bar("", 0);
16-
~~~~~~~~~~
16+
~~~
1717
!!! error TS2554: Expected 3 arguments, but got 2.
1818
!!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:3:20: An argument matching this binding pattern was not provided.
1919

tests/baselines/reference/baseCheck.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
3030
}
3131

3232
class D extends C { constructor(public z: number) { super(this.z) } } // too few params
33-
~~~~~~~~~~~~~
33+
~~~~~
3434
!!! error TS2554: Expected 2 arguments, but got 1.
3535
!!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
3636
~~~~

tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T
3333
}
3434
foo(10);
3535
foo(); // not ok - needs number
36-
~~~~~
36+
~~~
3737
!!! error TS2554: Expected 1 arguments, but got 0.
3838
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided.

tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T
3333
}
3434
foo(10);
3535
foo(); // not ok - needs number
36-
~~~~~
36+
~~~
3737
!!! error TS2554: Expected 1 arguments, but got 0.
3838
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts:1:14: An argument for 'a' was not provided.

tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e
2929
}
3030
foo(10);
3131
foo(); // not ok - needs number
32-
~~~~~
32+
~~~
3333
!!! error TS2554: Expected 1 arguments, but got 0.
3434
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided.
3535
}
3636
foo(10);
3737
foo(); // not ok - needs number
38-
~~~~~
38+
~~~
3939
!!! error TS2554: Expected 1 arguments, but got 0.
4040
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided.

tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): e
2323
}
2424
foo(10);
2525
foo(); // not ok
26-
~~~~~
26+
~~~
2727
!!! error TS2554: Expected 1 arguments, but got 0.
2828
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided.
2929
}
3030
foo(10);
3131
foo(); // not ok - needs number
32-
~~~~~
32+
~~~
3333
!!! error TS2554: Expected 1 arguments, but got 0.
3434
!!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided.

tests/baselines/reference/callOverload.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tests/cases/conformance/expressions/functionCalls/callOverload.ts(11,10): error
1919
!!! error TS2554: Expected 2 arguments, but got 4.
2020
withRest('a', ...n); // no error
2121
withRest();
22-
~~~~~~~~~~
22+
~~~~~~~~
2323
!!! error TS2555: Expected at least 1 arguments, but got 0.
2424
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callOverload.ts:3:27: An argument for 'a' was not provided.
2525
withRest(...n);

tests/baselines/reference/callWithMissingVoid.errors.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,1): error TS2554: Expected 1 arguments, but got 0.
2-
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,1): error TS2554: Expected 1 arguments, but got 0.
3-
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,1): error TS2554: Expected 1 arguments, but got 0.
1+
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,6): error TS2554: Expected 1 arguments, but got 0.
2+
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,10): error TS2554: Expected 1 arguments, but got 0.
3+
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,8): error TS2554: Expected 1 arguments, but got 0.
44
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(35,31): error TS2554: Expected 1 arguments, but got 0.
55
tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(36,35): error TS2554: Expected 1 arguments, but got 0.
66
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):
2828

2929
declare const xAny: X<any>;
3030
xAny.f() // error, any still expects an argument
31-
~~~~~~~~
31+
~
3232
!!! error TS2554: Expected 1 arguments, but got 0.
3333
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
3434

3535
declare const xUnknown: X<unknown>;
3636
xUnknown.f() // error, unknown still expects an argument
37-
~~~~~~~~~~~~
37+
~
3838
!!! error TS2554: Expected 1 arguments, but got 0.
3939
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
4040

4141
declare const xNever: X<never>;
4242
xNever.f() // error, never still expects an argument
43-
~~~~~~~~~~
43+
~
4444
!!! error TS2554: Expected 1 arguments, but got 0.
4545
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided.
4646

@@ -56,15 +56,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
5656
new MyPromise<void>(resolve => resolve()); // no error
5757
new MyPromise<void | number>(resolve => resolve()); // no error
5858
new MyPromise<any>(resolve => resolve()); // error, `any` arguments cannot be omitted
59-
~~~~~~~~~
59+
~~~~~~~
6060
!!! error TS2554: Expected 1 arguments, but got 0.
6161
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
6262
new MyPromise<unknown>(resolve => resolve()); // error, `unknown` arguments cannot be omitted
63-
~~~~~~~~~
63+
~~~~~~~
6464
!!! error TS2554: Expected 1 arguments, but got 0.
6565
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
6666
new MyPromise<never>(resolve => resolve()); // error, `never` arguments cannot be omitted
67-
~~~~~~~~~
67+
~~~~~~~
6868
!!! error TS2554: Expected 1 arguments, but got 0.
6969
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided.
7070

@@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
7878
a(4, "hello"); // ok
7979
a(4, "hello", void 0); // ok
8080
a(4); // not ok
81-
~~~~
81+
~
8282
!!! error TS2554: Expected 3 arguments, but got 1.
8383
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:42:23: An argument for 'y' was not provided.
8484

@@ -88,15 +88,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
8888

8989
b(4, "hello", void 0, 2); // ok
9090
b(4, "hello"); // not ok
91-
~~~~~~~~~~~~~
91+
~
9292
!!! error TS2554: Expected 4 arguments, but got 2.
9393
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:34: An argument for 'z' was not provided.
9494
b(4, "hello", void 0); // not ok
95-
~~~~~~~~~~~~~~~~~~~~~
95+
~
9696
!!! error TS2554: Expected 4 arguments, but got 3.
9797
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:43: An argument for 'what' was not provided.
9898
b(4); // not ok
99-
~~~~
99+
~
100100
!!! error TS2554: Expected 4 arguments, but got 1.
101101
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:23: An argument for 'y' was not provided.
102102

@@ -117,7 +117,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
117117
...args: TS): void;
118118

119119
call((x: number, y: number) => x + y) // error
120-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120+
~~~~
121121
!!! error TS2554: Expected 3 arguments, but got 1.
122122
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:73:5: An argument for 'args' was not provided.
123123
call((x: number, y: number) => x + y, 4, 2) // ok

tests/baselines/reference/classCanExtendConstructorFunction.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '
3838
class Sql extends Wagon {
3939
constructor() {
4040
super(); // error: not enough arguments
41-
~~~~~~~
41+
~~~~~
4242
!!! error TS2554: Expected 1 arguments, but got 0.
4343
!!! related TS6210 tests/cases/conformance/salsa/first.js:5:16: An argument for 'numberOxen' was not provided.
4444
this.foonly = 12

tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): error TS2554: Expected 1 arguments, but got 0.
1+
tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,3): error TS2554: Expected 1 arguments, but got 0.
22

33

44
==== tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts (1 errors) ====
@@ -15,6 +15,6 @@ tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): erro
1515

1616
var y: MyClass = new MyClass();
1717
y.myMethod(); // error
18-
~~~~~~~~~~~~
18+
~~~~~~~~
1919
!!! error TS2554: Expected 1 arguments, but got 0.
2020
!!! related TS6210 tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts:5:14: An argument for 'myList' was not provided.

tests/baselines/reference/functionCall11.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen
88
foo('foo', 1);
99
foo('foo');
1010
foo();
11-
~~~~~
11+
~~~
1212
!!! error TS2554: Expected 1-2 arguments, but got 0.
1313
!!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided.
1414
foo(1, 'bar');

tests/baselines/reference/functionCall12.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3'
88
foo('foo', 1);
99
foo('foo');
1010
foo();
11-
~~~~~
11+
~~~
1212
!!! error TS2554: Expected 1-3 arguments, but got 0.
1313
!!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided.
1414
foo(1, 'bar');

tests/baselines/reference/functionCall13.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1'
77
foo('foo', 1);
88
foo('foo');
99
foo();
10-
~~~~~
10+
~~~
1111
!!! error TS2555: Expected at least 1 arguments, but got 0.
1212
!!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided.
1313
foo(1, 'bar');

tests/baselines/reference/functionCall16.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1'
1111
foo('foo');
1212
foo('foo', 'bar');
1313
foo();
14-
~~~~~
14+
~~~
1515
!!! error TS2555: Expected at least 1 arguments, but got 0.
1616
!!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided.
1717
foo(1, 'bar');

tests/baselines/reference/functionCall17.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1'
1111
!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
1212
foo('foo');
1313
foo();
14-
~~~~~
14+
~~~
1515
!!! error TS2555: Expected at least 1 arguments, but got 0.
1616
!!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided.
1717
foo(1, 'bar');

tests/baselines/reference/functionCall18.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tests/cases/compiler/functionCall18.ts(4,1): error TS2554: Expected 2 arguments,
66
declare function foo<T>(a: T, b: T);
77
declare function foo(a: {});
88
foo<string>("hello");
9-
~~~~~~~~~~~~~~~~~~~~
9+
~~~
1010
!!! error TS2554: Expected 2 arguments, but got 1.
1111
!!! related TS6210 tests/cases/compiler/functionCall18.ts:2:31: An argument for 'b' was not provided.
1212

tests/baselines/reference/functionCall6.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments,
1313
~~~~~
1414
!!! error TS2554: Expected 1 arguments, but got 2.
1515
foo();
16-
~~~~~
16+
~~~
1717
!!! error TS2554: Expected 1 arguments, but got 0.
1818
!!! related TS6210 tests/cases/compiler/functionCall6.ts:1:14: An argument for 'a' was not provided.
1919

tests/baselines/reference/functionCall7.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments,
1515
~
1616
!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'.
1717
foo();
18-
~~~~~
18+
~~~
1919
!!! error TS2554: Expected 1 arguments, but got 0.
2020
!!! related TS6210 tests/cases/compiler/functionCall7.ts:2:14: An argument for 'a' was not provided.
2121

tests/baselines/reference/functionOverloads29.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads29.ts(4,9): error TS2554: Expected 1 argum
66
function foo(bar:number):number;
77
function foo(bar:any):any{ return bar }
88
var x = foo();
9-
~~~~~
9+
~~~
1010
!!! error TS2554: Expected 1 arguments, but got 0.
1111
!!! related TS6210 tests/cases/compiler/functionOverloads29.ts:1:14: An argument for 'bar' was not provided.
1212

tests/baselines/reference/functionOverloads34.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads34.ts(4,9): error TS2554: Expected 1 argum
66
function foo(bar:{a:boolean;}):number;
77
function foo(bar:{a:any;}):any{ return bar }
88
var x = foo();
9-
~~~~~
9+
~~~
1010
!!! error TS2554: Expected 1 arguments, but got 0.
1111
!!! related TS6210 tests/cases/compiler/functionOverloads34.ts:1:14: An argument for 'bar' was not provided.
1212

tests/baselines/reference/functionOverloads37.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads37.ts(4,9): error TS2554: Expected 1 argum
66
function foo(bar:{a:boolean;}[]):number;
77
function foo(bar:{a:any;}[]):any{ return bar }
88
var x = foo();
9-
~~~~~
9+
~~~
1010
!!! error TS2554: Expected 1 arguments, but got 0.
1111
!!! related TS6210 tests/cases/compiler/functionOverloads37.ts:1:14: An argument for 'bar' was not provided.
1212

tests/baselines/reference/functionParameterArityMismatch.errors.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp
1111
declare function f1(a: number);
1212
declare function f1(a: number, b: number, c: number);
1313
f1();
14-
~~~~
14+
~~
1515
!!! error TS2554: Expected 1-3 arguments, but got 0.
1616
!!! related TS6210 tests/cases/compiler/functionParameterArityMismatch.ts:1:21: An argument for 'a' was not provided.
1717
f1(1, 2);
18-
~~~~~~~~
18+
~~
1919
!!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
2020
f1(1, 2, 3, 4);
2121
~
@@ -26,13 +26,13 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp
2626
declare function f2(a: number, b: number, c: number, d: number);
2727
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
2828
f2(1);
29-
~~~~~
29+
~~
3030
!!! error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments.
3131
f2(1, 2, 3);
32-
~~~~~~~~~~~
32+
~~
3333
!!! error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments.
3434
f2(1, 2, 3, 4, 5);
35-
~~~~~~~~~~~~~~~~~
35+
~~
3636
!!! error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments.
3737
f2(1, 2, 3, 4, 5, 6, 7);
3838
~

0 commit comments

Comments
 (0)