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

Reflect.construct(): newTarget description incorrectly refers to the prototype of the constructor #35895

Closed
ajvincent opened this issue Sep 16, 2024 · 3 comments · Fixed by #35996
Labels
Content:JS JavaScript docs

Comments

@ajvincent
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct#newtarget

What specific section or headline is this issue about?

Parameters: newTarget

What information was incorrect, unhelpful, or incomplete?

"which usually specifies the prototype of the returned object." - this is incorrect.

What did you expect to see?

Something along the lines of "the function you called new with".

Do you have any supporting links, references, or citations?

Do you have anything more you want to share?

No response

@ajvincent ajvincent added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 16, 2024
@github-actions github-actions bot added the Content:JS JavaScript docs label Sep 16, 2024
@Josh-Cena
Copy link
Member

So I think "the value of new.target" sufficiently captures all the guaranteed semantics about this parameter, and anything else after it is just us trying to be helpful and talking about what happens in the general case. Normally object creation uses new.target.prototype as the prototype so this is certainly not wrong, but I would not be opposed to changing it to your suggestion.

@Josh-Cena Josh-Cena removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 16, 2024
@ajvincent
Copy link
Author

ajvincent commented Sep 16, 2024

FYI, I had to rewrite my construct-trap test for more clarity as to how it works.
https://github.com/ajvincent/es-membrane/blob/622d22bbbbb1f5263e6397f80cc2605df0b48b74/_00_ecma_references/spec/constructTrap.ts#L83

@Josh-Cena
Copy link
Member

Feel free to send a PR btw and we can discuss the wording, but I think your suggestion looks good.

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

Successfully merging a pull request may close this issue.

2 participants