-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix Node.js 17.5 compatibility #11381
Conversation
The tc39 async iterator helpers spec adds `.map` to async iterators and Node added support for that. As part of spec compliance Node uses defineProperty to add these properties. This PR fixes setting `.map` in Mongoose over the property. As a side note: it might make sense for Mongoose to deprecate `.map` since it's mutative which makes it named the same but with a different behavior from the tc39 iterator helpers proposal `.map`
FYI - this change works, I used it as a patch, but the same issue exists here |
Thanks @nateevans anywhere else? |
I'll let you know, actively going through it now |
Feel free to push to this branch or PR it if pushing directly doesn't work |
@benjamingr that seems to be the 2 files with the issue |
Can you please run the lint fixer over your code? npm run lint -- --fix |
@Uzlopak sure done |
Here it should be enumerable and configurable, shouldn't it? |
@Slayer95 probably not unless you think people are expecting it to show up on for… in loops |
I mean, the current implementation does that, so the fix should keep it. Otherwise, it might be the better plan to update all methods to your approach. Just pointing that out. Maintainer shall know better. |
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.
Thanks 👍 I'll make these properties enumerable and writable in master, if possible.
Your tutorial is missing the point. Downgrading to node 12 is like saying: Hey your Tesla needs Electricity, but to still use gasoline use a Ford Model-T. Despite the fact you could use a modern car, which uses gasoline. Also our CI/CD Pipelines is testing for node18, which actually would fail if that issue was still existing. But the patch by @benjamingr is solving that issue also for node18. So to solve that issue, you would need to upgrade mongoose to latest version OR use any version of node 17 except 17.5.0 and node 18 and above. A downgrade to node 12 is not necessary. And mongoose 6.3.2 does not has that issue, which you describe. |
The tc39 async iterator helpers spec adds
.map
to async iterators and Node added support for that.As part of spec compliance Node uses defineProperty to add these properties.
This PR fixes setting
.map
in Mongoose over the property.As a side note: it might make sense for Mongoose to deprecate
.map
since it's mutative which makes it named the same but with a different behavior from the tc39 iterator helpers proposal.map
Fixes: #11377