diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 00498191f28..ab35f15b604 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1511,6 +1511,9 @@ namespace ts { return undefined; } } + else if (name.kind === SyntaxKind.ParenthesizedExpression) { + return getSymbolOfNode(name.expression); + } else { Debug.fail("Unknown entity name kind."); } @@ -21069,7 +21072,6 @@ namespace ts { if (isHeritageClauseElementIdentifier(entityName)) { let meaning = SymbolFlags.None; - // In an interface or class, we're definitely interested in a type. if (entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments) { meaning = SymbolFlags.Type; @@ -21084,9 +21086,13 @@ namespace ts { } meaning |= SymbolFlags.Alias; - return resolveEntityName(entityName, meaning); + const entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (isPartOfExpression(entityName)) { + + if (isPartOfExpression(entityName)) { if (nodeIsMissing(entityName)) { // Missing entity name. return undefined; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 86895f3db6e..0f183c6b1fd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1395,7 +1395,7 @@ namespace ts { multiLine?: boolean; } - export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; + export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression | ParenthesizedExpression; export type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; export interface PropertyAccessExpression extends MemberExpression, Declaration { diff --git a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts new file mode 100644 index 00000000000..e22bd2351c4 --- /dev/null +++ b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts @@ -0,0 +1,12 @@ +interface I {} +interface CTor { + new (hour: number, minute: number): I +} +var x: { + B : CTor +}; +class B {} +function foo() { + return {B: B}; +} +class C extends (foo()).B {} \ No newline at end of file