mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
fix(39245): change related diagnostic for missing rest parameter arguments (#39356)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
parent
9b2d487392
commit
bae111f0ae
@ -26377,7 +26377,8 @@ namespace ts {
|
||||
if (paramDecl) {
|
||||
related = createDiagnosticForNode(
|
||||
paramDecl,
|
||||
isBindingPattern(paramDecl.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : Diagnostics.An_argument_for_0_was_not_provided,
|
||||
isBindingPattern(paramDecl.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided :
|
||||
isRestParameter(paramDecl) ? Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided : Diagnostics.An_argument_for_0_was_not_provided,
|
||||
!paramDecl.name ? argCount : !isBindingPattern(paramDecl.name) ? idText(getFirstIdentifier(paramDecl.name)) : undefined
|
||||
);
|
||||
}
|
||||
|
||||
@ -4473,6 +4473,10 @@
|
||||
"category": "Message",
|
||||
"code": 6235
|
||||
},
|
||||
"Arguments for the rest parameter '{0}' were not provided.": {
|
||||
"category": "Error",
|
||||
"code": 6236
|
||||
},
|
||||
|
||||
"Projects to reference": {
|
||||
"category": "Message",
|
||||
|
||||
@ -119,7 +119,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1):
|
||||
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.
|
||||
!!! related TS6236 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:73:5: Arguments for the rest parameter 'args' were not provided.
|
||||
call((x: number, y: number) => x + y, 4, 2) // ok
|
||||
|
||||
call((x: number, y: void) => x, 4, void 0) // ok
|
||||
|
||||
@ -12,7 +12,7 @@ tests/cases/conformance/types/rest/genericRestArity.ts(8,45): error TS2554: Expe
|
||||
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.
|
||||
!!! related TS6236 tests/cases/conformance/types/rest/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);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 8.
|
||||
|
||||
@ -12,7 +12,7 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,45): error TS2554
|
||||
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.
|
||||
!!! related TS6236 tests/cases/conformance/types/rest/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);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2554: Expected 3 arguments, but got 8.
|
||||
|
||||
@ -12,4 +12,4 @@ tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): err
|
||||
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.
|
||||
!!! related TS6236 tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts:3:5: Arguments for the rest parameter 'args' were not provided.
|
||||
Loading…
x
Reference in New Issue
Block a user