Repository navigation
Allow extending untranspiled classes - #8656
Merged
nicolo-ribaudo merged 1 commit intoMar 16, 2020
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9056/ |
xtuc
reviewed
Sep 10, 2018
This was referenced Feb 10, 2019
|
Any update? I have posted a question on StackOverflow which I think is related to this: |
minrk
added a commit
to jupyter-book/thebe
that referenced
this pull request
Aug 6, 2019
babel can't transpile classes that extend native classes babel/babel#8656
minrk
added a commit
to jupyter-book/thebe
that referenced
this pull request
Aug 6, 2019
babel can't transpile classes that extend native classes babel/babel#8656
minrk
added a commit
to jupyter-book/thebe
that referenced
this pull request
Aug 6, 2019
babel can't transpile classes that extend native classes babel/babel#8656
|
Merge please. |
|
Hey! |
|
+1 for getting this merged - thanks! |
nicolo-ribaudo
force-pushed
the
extend-native-class-2
branch
from
January 1, 2020 14:54
072d362 to
58c5857
Compare
|
great! |
JLHwung
self-requested a review
January 2, 2020 23:24
JLHwung
reviewed
Jan 20, 2020
nicolo-ribaudo
force-pushed
the
extend-native-class-2
branch
from
February 1, 2020 00:35
805390f to
af5fc16
Compare
nicolo-ribaudo
force-pushed
the
extend-native-class-2
branch
from
March 5, 2020 01:37
18f3901 to
53ff542
Compare
JLHwung
approved these changes
Mar 11, 2020
JLHwung
force-pushed
the
extend-native-class-2
branch
from
March 11, 2020 22:09
53ff542 to
dc76b43
Compare
nicolo-ribaudo
force-pushed
the
extend-native-class-2
branch
from
March 12, 2020 19:04
dc76b43 to
5495f14
Compare
This was referenced Apr 11, 2020
This was referenced Apr 20, 2020
This was referenced Apr 27, 2020
This was referenced May 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prev: #7081
This PR allows transpiled classes to extends untranspiled classes. This can happen, for example, when a dependency is transpiled using Babel and extends an user-provided class.
Example: Oblosys/react-lifecycle-visualizer#4
The new helper only allows extending native classes when
Reflect.constructis natively supported. Some envs (e.g. Node 4) have partial support for classes but don't provideReflect.construct: in this case users need to ensure that every class (also in their dependencies) is transpiled, like it was before.[1] If someone sets
.constructorto something else, the new helper won't work. e.g.A workaround to avoid the breaking change could be to only use the
Reflect-based version of the helper only ifFunction.toString.call(SuperClass).slice(0, 5) === "class", but in those casesthis.constructorstill can't be modified.