@@ -22807,11 +22807,7 @@ namespace ts {
2280722807 addDiagnostic(UnusedKind.Local, createDiagnosticForNode(node, message, name));
2280822808 }
2280922809
22810- function parameterNameStartsWithUnderscore(parameterName: DeclarationName) {
22811- return parameterName && isIdentifierThatStartsWithUnderScore(parameterName);
22812- }
22813-
22814- function isIdentifierThatStartsWithUnderScore(node: Node) {
22810+ function isIdentifierThatStartsWithUnderscore(node: Node) {
2281522811 return isIdentifier(node) && idText(node).charCodeAt(0) === CharacterCodes._;
2281622812 }
2281722813
@@ -22859,7 +22855,7 @@ namespace ts {
2285922855 const typeParameters = getEffectiveTypeParameterDeclarations(node);
2286022856 if (!(node.flags & NodeFlags.Ambient) && last(getSymbolOfNode(node).declarations) === node) {
2286122857 for (const typeParameter of typeParameters) {
22862- if (!(getMergedSymbol(typeParameter.symbol).isReferenced! & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderScore (typeParameter.name)) {
22858+ if (!(getMergedSymbol(typeParameter.symbol).isReferenced! & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderscore (typeParameter.name)) {
2286322859 addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(typeParameter.symbol)));
2286422860 }
2286522861 }
@@ -22897,7 +22893,7 @@ namespace ts {
2289722893
2289822894 for (const declaration of local.declarations) {
2289922895 if (isAmbientModule(declaration) ||
22900- (isVariableDeclaration(declaration) && isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderScore (declaration.name!)) {
22896+ (isVariableDeclaration(declaration) && isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderscore (declaration.name!)) {
2290122897 continue;
2290222898 }
2290322899
@@ -22916,9 +22912,9 @@ namespace ts {
2291622912 }
2291722913 else {
2291822914 const parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration);
22919- if (parameter) {
22920- const name = getNameOfDeclaration(local.valueDeclaration);
22921- if (!isParameterPropertyDeclaration(parameter) && !parameterIsThisKeyword(parameter) && !parameterNameStartsWithUnderscore (name)) {
22915+ const name = getNameOfDeclaration(local.valueDeclaration);
22916+ if (parameter && name) {
22917+ if (!isParameterPropertyDeclaration(parameter) && !parameterIsThisKeyword(parameter) && !isIdentifierThatStartsWithUnderscore (name)) {
2292222918 addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local)));
2292322919 }
2292422920 }
@@ -24213,18 +24209,19 @@ namespace ts {
2421324209 }
2421424210
2421524211 const propDeclaration = prop.valueDeclaration;
24212+ const name = getNameOfDeclaration(propDeclaration);
2421624213
2421724214 // index is numeric and property name is not valid numeric literal
24218- if (indexKind === IndexKind.Number && !(propDeclaration ? isNumericName(getNameOfDeclaration(propDeclaration) ) : isNumericLiteralName(prop.escapedName))) {
24215+ if (indexKind === IndexKind.Number && !(name ? isNumericName(name ) : isNumericLiteralName(prop.escapedName))) {
2421924216 return;
2422024217 }
2422124218
2422224219 // perform property check if property or indexer is declared in 'type'
2422324220 // this allows us to rule out cases when both property and indexer are inherited from the base class
2422424221 let errorNode: Node | undefined;
24225- if (propDeclaration &&
24222+ if (propDeclaration && name &&
2422624223 (propDeclaration.kind === SyntaxKind.BinaryExpression ||
24227- getNameOfDeclaration(propDeclaration) .kind === SyntaxKind.ComputedPropertyName ||
24224+ name .kind === SyntaxKind.ComputedPropertyName ||
2422824225 prop.parent === containingType.symbol)) {
2422924226 errorNode = propDeclaration;
2423024227 }
0 commit comments