Skip to content

Commit

Permalink
fix(__extends): Use correct behaviour with null prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
ExE-Boss committed Jan 6, 2021
1 parent 54a056a commit b04b8d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tslib.d.ts
Expand Up @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
export declare function __extends(d: Function, b: Function): void;
export declare function __extends(d: Function, b: Function | null): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
Expand Down
9 changes: 7 additions & 2 deletions tslib.es6.js
Expand Up @@ -22,11 +22,16 @@ var extendStatics = function(d, b) {
};

export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
if (b === null) {
(d.prototype = Object.create(b)).constructor = d;
return;
} else if (typeof b !== "function") {
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
}
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
__.prototype = b.prototype;
d.prototype = new __();
}

export var __assign = function() {
Expand Down
9 changes: 7 additions & 2 deletions tslib.js
Expand Up @@ -66,11 +66,16 @@ var __createBinding;
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };

__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
if (b === null) {
(d.prototype = Object.create(b)).constructor = d;
return;
} else if (typeof b !== "function") {
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
}
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
__.prototype = b.prototype;
d.prototype = new __();
};

__assign = Object.assign || function (t) {
Expand Down

0 comments on commit b04b8d0

Please sign in to comment.