Skip to content

Added new diagnostics message to clarify error for type guards#7348

Merged
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
Vinatorul:issue6540
Mar 2, 2016
Merged

Added new diagnostics message to clarify error for type guards#7348
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
Vinatorul:issue6540

Conversation

@Vinatorul
Copy link
Copy Markdown
Contributor

Fixes #6540

New diagnostics message "A type guard's type must be assignable to its parameter's type." number 2677
is now using in chain report to clarify vague error message for type guards.

@msftclas
Copy link
Copy Markdown

msftclas commented Mar 2, 2016

Hi @Vinatorul, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

Comment thread src/compiler/checker.ts Outdated
getTypeOfNode(parent.parameters[typePredicate.parameterIndex]),
node.type);
node.type,
undefined,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually when we pass arguments with the value undefined, we like to add a comment with the parameter name and a space after. So for instance, instead of

undefined,

I would write

/*headMessage*/ undefined,

@RyanCavanaugh
Copy link
Copy Markdown
Member

👍 after Dan's comments

@DanielRosenwasser
Copy link
Copy Markdown
Member

This looks great @Vinatorul. I just had a few style suggestions. We think you should change the error message as I've brought up above.

@Vinatorul
Copy link
Copy Markdown
Contributor Author

@DanielRosenwasser thank you! After tests finish I will amend all changes.

New diagnostics message "A type guard's type must be assignable to its parameter's type." number 2677
is now using in chain report to clarify vague error message for type guards.
@Vinatorul
Copy link
Copy Markdown
Contributor Author

@DanielRosenwasser done

DanielRosenwasser added a commit that referenced this pull request Mar 2, 2016
Added new diagnostics message to clarify error for type guards
@DanielRosenwasser DanielRosenwasser merged commit d6c5606 into microsoft:master Mar 2, 2016
@Vinatorul Vinatorul deleted the issue6540 branch March 2, 2016 22:00
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants