TypeScript/tests/cases/compiler/extendsJavaScript.ts
Martin Probst 7a2b2cebbf Do not emit code for @extends tags in JS. (#29244)
When transpiling JavaScript, TS3.1+ emits `@extends` tags as code. E.g.

    /** @extends {SuperClass} */
    class SubClass {}

Causes an ES5 emit that references SuperClass:

    /**
    * @extends {SomeBase}
    */
    var SubClass = /** @class */ (function (_super) {
        __extends(SubClass, _super);
        function SubClass() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        return SubClass;
    }(SomeBase));

Note the literal references to `SomeBase`.

This appears to be an accidental effect of 0f55566cf4. It refactored
`getEffectiveBaseTypeNode` for type checking, but missed an instance
where it is also used for emit logic. This change fixes the problem by
specifically getting the heritage clauses directly off the AST.

Change-Id: I3128a757e5924e2528c61230a90ac13650852542
2019-01-04 08:13:14 -08:00

12 lines
141 B
TypeScript

// @allowJs: true
// @checkJs: false
// @outDir: ./out
// @filename: extendsJavaScript.js
/**
* @extends {SomeBase}
*/
class MyClass {
}