Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix derived classes in Chrome <= 36 #14072

Merged
merged 2 commits into from Dec 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/babel-helpers/src/helpers.ts
Expand Up @@ -335,16 +335,16 @@ helpers.inherits = helper("7.0.0-beta.0")`
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
Object.defineProperty(subClass, "prototype", {
value: Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
}),
writable: false,
// We can't use defineProperty to set the prototype in a single step because it
// doesn't work in Chrome <= 36. https://github.com/babel/babel/issues/14056
nicolo-ribaudo marked this conversation as resolved.
Show resolved Hide resolved
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) setPrototypeOf(subClass, superClass);
}
`;
Expand Down