-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(NODE-6259): replace dynamically assigned length property with a static getter #4173
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-6259): replace dynamically assigned length property with a static getter #4173
Conversation
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 so much for jumping on this @sis0k0!
The Object.defineProperty(BulkOperationBase.prototype, 'length' style of declaring class members is no longer needed since we're writing code with class syntax now. This field was overlooked when the driver was rewritten in TS, thanks for catching it and improving things!
Description
The length property was declared on the
BulkOperationBaseinterface in the@types/mongodbpackage. With version 4.0, installing@types/mongodbis no longer required. However, the declarations generated in themongodbpackage don't have thelengthproperty.What is changing?
The
BulkOperationBasetype now has alengthproperty. This was the behaviour when using@types/mongodb.Is there new documentation needed for these changes?
No
What is the motivation for this change?
See this discussion in the Community Forums.
Release Highlight
BulkOperationBase(super class ofUnorderedBulkOperationandOrderedBulkOperation) now reportslengthproperty in TypescriptThe
lengthgetter for these classes was defined manually usingObject.definePropertywhich hid it from typescript. Thanks to @sis0k0 we now have the getter defined on the class, which is functionally the same, but a greatly improved DX when working with types. 🎉Double check the following
npm run check:lintscripttype(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript