Skip to content

adds error message for using value as type argument - #37359

Merged
Andrew Casey (amcasey) merged 1 commit into
microsoft:masterfrom
amcasey:Updated32543
Mar 12, 2020
Merged

Andrew Casey (amcasey) merged 1 commit into
microsoft:masterfrom
amcasey:Updated32543

Conversation

@amcasey

Copy link
Copy Markdown
Member

This addresses issue #28975
(#28975).

When providing a value as a type argument, we can suggest a more specific
error message: "Did you mean to use typeof T?"

adds error message

WIP: Detect error

WIP: progress

updated tests

janky implementation

adds test coverage around literal types being unaffected

refactor out isIdentifierATypeArgument function

adds test case for type alias

adds test case for nested type arguments

fixes linting errors

merge master into branch to overwrite changes

changes value as type error message

This suggests 'typeof T' as a potential alternative when we give an error
about using value T as a type.

remove stale tests from old change

This addresses issue microsoft#28975
(microsoft#28975).

When providing a value as a type argument, we can suggest a more specific
error message: "Did you mean to use typeof T?"

adds error message

WIP: Detect error

WIP: progress

updated tests

janky implementation

adds test coverage around literal types being unaffected

refactor out isIdentifierATypeArgument function

adds test case for type alias

adds test case for nested type arguments

fixes linting errors

merge master into branch to overwrite changes

changes value as type error message

This suggests 'typeof T' as a potential alternative when we give an error
about using value T as a type.

remove stale tests from old change
@amcasey

Copy link
Copy Markdown
Member Author

This is a squash and rebase of #32543. I bet there was a clever way to update that PR, but I didn't want to mess up anyone's fork. All credit goes to John Patterson (@john-patterson).

@amcasey Andrew Casey (amcasey) added the For Backlog Bug PRs that fix a backlog bug label Mar 12, 2020
@amcasey
Andrew Casey (amcasey) merged commit 9e97b00 into microsoft:master Mar 12, 2020
@amcasey
Andrew Casey (amcasey) deleted the Updated32543 branch March 12, 2020 02:18
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants