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

README suggests classes can be constructed using new but this does not appear to be the case. #46

Open
yyny opened this issue Oct 29, 2017 · 2 comments
Assignees
Labels

Comments

@yyny
Copy link

yyny commented Oct 29, 2017

As shown and stated here.

Relevant example shown in README:

var looker = new Looker()     // > A looker is born!
looker.look()                 // > Looking good!
looker instanceof Looker      // true

Specifically, line 45 of index.js contains code which eventually returns an instance of (...args) => new Class(...args) (which has been like this for over 6 months ago), which cannot be called as a constructor (Since it is an arrow function).

new (() => {}); //=> Uncaught TypeError: (intermediate value) is not a constructor
                //=>    at <anonymous>:1:1

Using function(...args) { return new Class(...args) } instead would make the code work (without compilation) for platforms that disallow arrow functions as constructors (As required by ES6).

@mindfullsilence
Copy link

Yeah this is a bummer. I really like this library, powerful tool in my toolbelt. But the opinionated decision of trying to work around usingnew gets me down. Honestly I prefer new. It's easier to read when something is being instantiated in the middle of a few hundred lines of code.

@Download
Copy link
Owner

Hi guys, I see what the problem is and will look at this soon.
Sorry for the late response but this is Open Source and I do it in my spare time.

@Download Download added the bug label Mar 23, 2018
@Download Download self-assigned this Mar 23, 2018
Download added a commit that referenced this issue Jul 16, 2018
README suggests classes can be constructed using `new` but this does not appear to be the case. #46
#46
The issue only occurs in untranspiled code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants