diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a55f17f8aac..041ea6dbfd6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1642,7 +1642,7 @@ namespace ts { function isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult { // get symbol of the first identifier of the entityName let meaning: SymbolFlags; - if (entityName.parent.kind === SyntaxKind.TypeQuery) { + if (entityName.parent.kind === SyntaxKind.TypeQuery || isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; } diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.js b/tests/baselines/reference/declarationEmit_expressionInExtends.js new file mode 100644 index 00000000000..061042aa34b --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.js @@ -0,0 +1,49 @@ +//// [declarationEmit_expressionInExtends.ts] + +var x: { + new(s: any): Q; +} + +class Q { + s: string; +} + +class B extends x { +} + +var q: B; +q.s; + +//// [declarationEmit_expressionInExtends.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var x; +var Q = (function () { + function Q() { + } + return Q; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +}(x)); +var q; +q.s; + + +//// [declarationEmit_expressionInExtends.d.ts] +declare var x: { + new (s: any): Q; +}; +declare class Q { + s: string; +} +declare class B extends x { +} +declare var q: B; diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.symbols b/tests/baselines/reference/declarationEmit_expressionInExtends.symbols new file mode 100644 index 00000000000..2120ad4ddde --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends.ts === + +var x: { +>x : Symbol(x, Decl(declarationEmit_expressionInExtends.ts, 1, 3)) + + new(s: any): Q; +>T : Symbol(T, Decl(declarationEmit_expressionInExtends.ts, 2, 8)) +>s : Symbol(s, Decl(declarationEmit_expressionInExtends.ts, 2, 11)) +>Q : Symbol(Q, Decl(declarationEmit_expressionInExtends.ts, 3, 1)) +} + +class Q { +>Q : Symbol(Q, Decl(declarationEmit_expressionInExtends.ts, 3, 1)) + + s: string; +>s : Symbol(s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) +} + +class B extends x { +>B : Symbol(B, Decl(declarationEmit_expressionInExtends.ts, 7, 1)) +>x : Symbol(x, Decl(declarationEmit_expressionInExtends.ts, 1, 3)) +} + +var q: B; +>q : Symbol(q, Decl(declarationEmit_expressionInExtends.ts, 12, 3)) +>B : Symbol(B, Decl(declarationEmit_expressionInExtends.ts, 7, 1)) + +q.s; +>q.s : Symbol(Q.s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) +>q : Symbol(q, Decl(declarationEmit_expressionInExtends.ts, 12, 3)) +>s : Symbol(Q.s, Decl(declarationEmit_expressionInExtends.ts, 5, 9)) + diff --git a/tests/baselines/reference/declarationEmit_expressionInExtends.types b/tests/baselines/reference/declarationEmit_expressionInExtends.types new file mode 100644 index 00000000000..2e810fccf68 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_expressionInExtends.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/declarationEmit_expressionInExtends.ts === + +var x: { +>x : new (s: any) => Q + + new(s: any): Q; +>T : T +>s : any +>Q : Q +} + +class Q { +>Q : Q + + s: string; +>s : string +} + +class B extends x { +>B : B +>x : Q +} + +var q: B; +>q : B +>B : B + +q.s; +>q.s : string +>q : B +>s : string + diff --git a/tests/cases/compiler/declarationEmit_expressionInExtends.ts b/tests/cases/compiler/declarationEmit_expressionInExtends.ts new file mode 100644 index 00000000000..8544ca20d92 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_expressionInExtends.ts @@ -0,0 +1,15 @@ +// @declaration: true + +var x: { + new(s: any): Q; +} + +class Q { + s: string; +} + +class B extends x { +} + +var q: B; +q.s; \ No newline at end of file