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

GetPrototypeOf fails for arrow functions #17

Closed
calebboyd opened this issue Dec 21, 2015 · 0 comments
Closed

GetPrototypeOf fails for arrow functions #17

calebboyd opened this issue Dec 21, 2015 · 0 comments

Comments

@calebboyd
Copy link

Arrow functions do not have a prototype so this will fail when they are reflected upon.

//GetPrototypeOf
// When O = () => 'abc' this fails
let prototype = O.prototype; //undefined
let prototypeProto = Object.getPrototypeOf(prototype); // throws Uncaught TypeError: Cannot convert undefined or null to object(…)
if (prototypeProto == null || prototypeProto === Object.prototype) {
    return proto;
}

Found when attempting to use an arrow function in and angular2 project with: provide(SomeToken, { useFactory: () => 'abc' })
I'd send a PR but I can't seem to get the tests running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant