Skip to content

Change the emit for __extends to support easy global override #1622

@basarat

Description

@basarat

Change the emit for __extends to be :

var __root = typeof global !== "undefined" && global || typeof window !== "undefined" && window || this;
var __extends = __root.__extends = __root.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
}

Reason:

It will allow you to override __extends globally with a single require call to a file that contains the following:

var __root = typeof global !== "undefined" && global || typeof window !== "undefined" && window || this;
__root.__extends = function(d,b){/*custom __extends implementation*/}

Note: all AMD / CommonJS / internal modules will work

More : #1601 (comment)

Metadata

Metadata

Assignees

Labels

Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions