From d865ea774af43b0e3563064edb7fa12a199be1ce Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Fri, 26 Apr 2019 00:43:43 +0200 Subject: [PATCH] resolveName: remove useless case (#28669) PropertySignature cannot occur in a class. The condition inside the clause required the parent to be a class, so it was never true. This removes the case clause and the part of the condition that is now useless. --- src/compiler/checker.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7431d2118426e..473b41ccec5e2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1409,15 +1409,14 @@ namespace ts { } break; case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (isClassLike(location.parent) && !hasModifier(location, ModifierFlags.Static)) { - const ctor = findConstructorDeclaration(location.parent); + if (!hasModifier(location, ModifierFlags.Static)) { + const ctor = findConstructorDeclaration(location.parent as ClassLikeDeclaration); if (ctor && ctor.locals) { if (lookup(ctor.locals, name, meaning & SymbolFlags.Value)) { // Remember the property node, it will be used later to report appropriate error