Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

TypeScript helpers are needlessly duplicated #24

Closed
Victorystick opened this issue Jan 22, 2016 · 1 comment
Closed

TypeScript helpers are needlessly duplicated #24

Victorystick opened this issue Jan 22, 2016 · 1 comment

Comments

@Victorystick
Copy link
Contributor

When importing more than one class from separate files the __extends helper is needlessly duplicated. Bundling main.ts below

// main.ts
export { A } from './A';
export { B } from './B';

// Base.ts
export default class Base {}

// A.ts
import Base from './Base';
export class A extends Base {}

// B.ts
import Base from './Base';
export class B extends Base {}

yields

var Base = (function () {
    function Base() {
    }
    return Base;
})();

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 A = (function (_super) {
    __extends(A, _super);
    function A() {
        _super.apply(this, arguments);
    }
    return A;
})(Base);

var __extends$1 = (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 B = (function (_super) {
    __extends$1(B, _super);
    function B() {
        _super.apply(this, arguments);
    }
    return B;
})(Base);

export { A, B };

We should not include duplicate helpers.

@Victorystick
Copy link
Contributor Author

Will be part of 0.5.0.

function __extends(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 Base = (function () {
    function Base() {
    }
    return Base;
})();

var A = (function (_super) {
    __extends(A, _super);
    function A() {
        _super.apply(this, arguments);
    }
    return A;
})(Base);

var B = (function (_super) {
    __extends(B, _super);
    function B() {
        _super.apply(this, arguments);
    }
    return B;
})(Base);

export { A, B };

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant