This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Fix for rest parameters in unified-signatures
#2342
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
unified-signatures
erroneously claims overloads can be combined #2338Overview of change:
signaturesDifferByOptionalOrRestParameter()
previously considered two signatures similar if the common parameters had the same type, but it did not consider thedotDotDotToken
sigil when it dd that comparison. This change has the function check the last parameter of the shorter signature to see if it is a rest parameter. If so, it may not be possible to combine the two signatures.Is there anything you'd like reviewers to focus on?
This change makes tslint more lenient about a particular scenario:
tslint previously correctly noted that those signatures could be combined. After this change it does not warn about them. Reviewer should consider whether fixing the false warning of #2338 in exchange for failing to warn in this alternative case is a net improvement.
[bugfix]
unified-signatures
now recognizes rest parameters