Improve decorator on overload error message#6129
Merged
DanielRosenwasser merged 1 commit intomicrosoft:masterfrom Dec 21, 2015
Merged
Improve decorator on overload error message#6129DanielRosenwasser merged 1 commit intomicrosoft:masterfrom
DanielRosenwasser merged 1 commit intomicrosoft:masterfrom
Conversation
Contributor
|
implementation-wise looks ok, modulo one comment. Also can you add one more test to capture the correct case: method with overload and decorator is placed on implementation? Pinging @DanielRosenwasser to see if he has any comments on phrasing of the error message? |
Member
|
The message's grammar looks fine to me but might still violate some error message guidelines that I haven't learned yet. |
Member
|
Considering I was the one who originally suggested this message, I'm biased 😄 @pimterry let's add the inverse test and we should be good to pull this in. |
Member
|
Actually, I'll just add the inverse test. Thanks for the PR! |
DanielRosenwasser
added a commit
that referenced
this pull request
Dec 21, 2015
Improve decorator on overload error message
DanielRosenwasser
added a commit
that referenced
this pull request
Dec 21, 2015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This fixes #6064, by improving the error message in the case when a decorator is rejected for being on a method overload, not an implementation.
I'm happy this works, but I'm not super happy with the detection of whether it's a method overload (currently: it's a method declaration without a body, which can't be decorated). I'm not familiar with the structure of the TypeScript codebase yet though, and I can't find any existing methods that define exactly how to check whether a node is an overload declaration.
I've opened this PR regardless for now, to check I'm on the right track, and because it is working and mergeable if you're happy with the approach.
Any suggestions on tidying that check up, or if that's required at all? If there's nothing already existing for this then should I be refactoring this check out somewhere? (and if so where?)