Skip to content

Commit 5f74ae1

Browse files
ExE-Bossrbuckton
andcommitted
fix(__extends): Use correct behaviour with null prototype
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
1 parent 54a056a commit 5f74ae1

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Diff for: tslib.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1212
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1313
PERFORMANCE OF THIS SOFTWARE.
1414
***************************************************************************** */
15-
export declare function __extends(d: Function, b: Function): void;
15+
export declare function __extends(d: Function, b: Function | null): void;
1616
export declare function __assign(t: any, ...sources: any[]): any;
1717
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
1818
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;

Diff for: tslib.es6.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ var extendStatics = function(d, b) {
2424
export function __extends(d, b) {
2525
if (typeof b !== "function" && b !== null)
2626
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27-
extendStatics(d, b);
28-
function __() { this.constructor = d; }
29-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27+
function __() {}
28+
(d.prototype = b ? (extendStatics(d, b), __.prototype = b.prototype, new __()) : Object.create(b)).constructor = d;
3029
}
3130

3231
export var __assign = function() {

Diff for: tslib.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ var __createBinding;
6868
__extends = function (d, b) {
6969
if (typeof b !== "function" && b !== null)
7070
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
71-
extendStatics(d, b);
72-
function __() { this.constructor = d; }
73-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
71+
function __() {}
72+
(d.prototype = b ? (extendStatics(d, b), __.prototype = b.prototype, new __()) : Object.create(b)).constructor = d;
7473
};
7574

7675
__assign = Object.assign || function (t) {

0 commit comments

Comments
 (0)