Skip to content

#40763 Fixed: Bad error message when forgetting a comma in an array of templ… #40907

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

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

richa008
Copy link
Contributor

@richa008 richa008 commented Oct 2, 2020

Added the error message mentioned by @DanielRosenwasser as a part of grace hopper OSD.

Fixes #40763

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 2, 2020
@@ -3048,6 +3048,10 @@
"category": "Error",
"code": 2795
},
"It is likely that you are missing a comma to separate these two template expressions. They form form a tagged template expression which is invalid.": {
Copy link
Member

Choose a reason for hiding this comment

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

Apart from the duplicate "form form", @sandersn what do you think?

Suggested change
"It is likely that you are missing a comma to separate these two template expressions. They form form a tagged template expression which is invalid.": {
"It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.": {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that sounds reasonable to me.

@@ -27872,6 +27872,12 @@ namespace ts {
return resolveUntypedCall(node);
}

if (isArrayLiteralExpression(node.parent)) {
Copy link
Member

Choose a reason for hiding this comment

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

I would move this into the !callSignatures.length check because there is technically a way to make this work in the type system.

interface String {
    (...args: any[]): any;
}

// should not error.
let x = [
  `hello`
  `world`
];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sandersn sandersn merged commit b748484 into microsoft:master Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad error message when forgetting a comma in an array of template strings
4 participants