diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 300928f229d53..d405784ed609d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1272,8 +1272,10 @@ namespace ts { case SyntaxKind.PropertyAccessExpression: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; case SyntaxKind.ExpressionWithTypeArguments: - Debug.assert(isEntityNameExpression((node).expression)); - return (node).expression; + if (isEntityNameExpression((node).expression)) { + return (node).expression; + } + // falls through default: return undefined; } diff --git a/tests/baselines/reference/classExtendsInterface_not.errors.txt b/tests/baselines/reference/classExtendsInterface_not.errors.txt new file mode 100644 index 0000000000000..6a4b250cb3e41 --- /dev/null +++ b/tests/baselines/reference/classExtendsInterface_not.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/classExtendsInterface_not.ts(1,20): error TS2339: Property 'bogus' does not exist on type '""'. + + +==== tests/cases/compiler/classExtendsInterface_not.ts (1 errors) ==== + class C extends "".bogus {} + ~~~~~ +!!! error TS2339: Property 'bogus' does not exist on type '""'. + \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsInterface_not.js b/tests/baselines/reference/classExtendsInterface_not.js new file mode 100644 index 0000000000000..3bbd6c9ffbaa6 --- /dev/null +++ b/tests/baselines/reference/classExtendsInterface_not.js @@ -0,0 +1,22 @@ +//// [classExtendsInterface_not.ts] +class C extends "".bogus {} + + +//// [classExtendsInterface_not.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var C = /** @class */ (function (_super) { + __extends(C, _super); + function C() { + return _super !== null && _super.apply(this, arguments) || this; + } + return C; +}("".bogus)); diff --git a/tests/baselines/reference/classExtendsInterface_not.symbols b/tests/baselines/reference/classExtendsInterface_not.symbols new file mode 100644 index 0000000000000..de4af3a5c16f9 --- /dev/null +++ b/tests/baselines/reference/classExtendsInterface_not.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/classExtendsInterface_not.ts === +class C extends "".bogus {} +>C : Symbol(C, Decl(classExtendsInterface_not.ts, 0, 0)) + diff --git a/tests/baselines/reference/classExtendsInterface_not.types b/tests/baselines/reference/classExtendsInterface_not.types new file mode 100644 index 0000000000000..cd1d6272476bd --- /dev/null +++ b/tests/baselines/reference/classExtendsInterface_not.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/classExtendsInterface_not.ts === +class C extends "".bogus {} +>C : C +>"".bogus : any +>"" : "" +>bogus : any + diff --git a/tests/cases/compiler/classExtendsInterface_not.ts b/tests/cases/compiler/classExtendsInterface_not.ts new file mode 100644 index 0000000000000..25a93e787e639 --- /dev/null +++ b/tests/cases/compiler/classExtendsInterface_not.ts @@ -0,0 +1 @@ +class C extends "".bogus {}