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

support for object.assign() inheritance #263

Open
kimus opened this issue Dec 19, 2017 · 0 comments
Open

support for object.assign() inheritance #263

kimus opened this issue Dec 19, 2017 · 0 comments

Comments

@kimus
Copy link

kimus commented Dec 19, 2017

Super class:

var Animal = function() {
}

Animal.prototype.sleep = function() { ... }

Inherit from Super:

var Dog = function() {
}

Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;

This is not supported, converted has is:

Object.assign(Dog.prototype, {
    talk: function() { ... }
});

Workaround that generates proper code:

Dog.prototype = {
    talk: function() { ... }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants