mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-27 04:48:33 -05:00
Report errors from duplicate member names
This commit is contained in:
@@ -1815,7 +1815,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getSymbolOfNode(node: Node): Symbol {
|
||||
return getMergedSymbol(node.symbol);
|
||||
return getMergedSymbol(node.symbol && node.symbol.name === "__computed" && node.id && getNodeLinks(node).resolvedSymbol || node.symbol);
|
||||
}
|
||||
|
||||
function getParentOfSymbol(symbol: Symbol): Symbol {
|
||||
@@ -19502,7 +19502,10 @@ namespace ts {
|
||||
// initializer is consistent with type associated with the node
|
||||
const declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));
|
||||
if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {
|
||||
error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(type), typeToString(declarationType));
|
||||
const message = node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature
|
||||
? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
|
||||
: Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
|
||||
error(node.name, message, declarationNameToString(node.name), typeToString(type), typeToString(declarationType));
|
||||
}
|
||||
if (node.initializer) {
|
||||
checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined);
|
||||
|
||||
@@ -2123,6 +2123,10 @@
|
||||
"category": "Error",
|
||||
"code": 2710
|
||||
},
|
||||
"Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.": {
|
||||
"category": "Error",
|
||||
"code": 2711
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
Reference in New Issue
Block a user