Skip to content
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

Subsequent variable declarations must have same type: Mention location of other declaration #19356

Merged
2 commits merged into from
Oct 20, 2017

Conversation

ghost
Copy link

@ghost ghost commented Oct 19, 2017

Fixes #19339

@ghost ghost requested a review from sandersn October 19, 2017 22:09
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Just some minor naming/formatting changes.

const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration);
const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration);
const otherLocation = getLineAndCharacterOfPosition(valueDeclarationSourceFile, otherSpan.start);
const otherLocationDescription = `${valueDeclarationSourceFile.fileName} ${otherLocation.line}:${otherLocation.character}`;
Copy link
Member

Choose a reason for hiding this comment

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

is the chrome debugger issue with template literals fixed? It doesn't look like it, so probably it's better not avoid template literals for now.

@@ -20803,6 +20802,21 @@ namespace ts {
}
}

function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void {
Copy link
Member

Choose a reason for hiding this comment

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

I'd use 'Next' consistently for the function name and for -Type and -Declaration. It's easier to type than subsequent.

@@ -20803,6 +20802,21 @@ namespace ts {
}
}

function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void {
const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration);
const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration);
Copy link
Member

Choose a reason for hiding this comment

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

and 'first/next' for local names too.

@ghost ghost merged commit d7be61a into master Oct 20, 2017
@ghost ghost deleted the subsequent branch October 20, 2017 15:33
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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.

1 participant