New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly mark vararg parameters in TypescriptDefinition #2239
Conversation
Mark e.g. min as `min(arg1: number, ...arg2: number[])`, otherwise the method cannot be called correctly from Typescript.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2239 +/- ##
=========================================
Coverage 37.43% 37.44%
- Complexity 19837 19841 +4
=========================================
Files 1110 1110
Lines 169562 169570 +8
Branches 35817 35817
=========================================
+ Hits 63483 63492 +9
+ Misses 96012 96011 -1
Partials 10067 10067
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
That probably makes sense. I would still like to keep this because it is more correct, and we might have some real use case for varargs in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this, and for being perhaps the first person to read through and understand this class :)
Currently parameters that take a variadic number of arguments are marked as regular array types, e.g.
min(arg1: number, arg2: number[])
.That signature only lets you call as
min(1, [2, 3])
, which is incorrect and fails.Instead, it should be marked as
min(arg1: number, ...arg2: number[])
, otherwise the method cannot be called correctly from Typescript.(I considered introducing an inner Parameter helper class, but that makes the descriptiveParamNames and combatFilterType overrides less convenient to handle. Let me know if I should give it a go.)