-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc: 'constructor' implies use of new keyword #17364
Conversation
the square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also turn square
into Square
in this case? It’s a bit more common to start constructor names with a capital letter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once @addaleax's comment is addressed
Very good point. Updated. |
No objection, but a simpler fix might be to leave the code as is and simply remove the words |
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Landed in 1449c18 Thanks for the contribution @CameronMoorehead! Congrats on becoming a Contributor!! 🎉 |
Shouldn’t the example |
@charmander Yes. 👍PR coming up... this is what happens when no one clicks to see the rest of the code 😆 |
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
Arrow functions cannot be called with the new keyword, convert to ES6 classes instead. PR-URL: #17579 Refs: #17364 Reviewed-By: Rich Trott <[email protected]>
the square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc