-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(NODE-6259): replace dynamically assigned length property with a static getter #4173
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
BulkOperationBase
interface in the@types/mongodb
package. With version 4.0, installing@types/mongodb
is no longer required. However, the declarations generated in themongodb
package don't have thelength
property.What is changing?
The
BulkOperationBase
type now has alength
property. 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 ofUnorderedBulkOperation
andOrderedBulkOperation
) now reportslength
property in TypescriptThe
length
getter for these classes was defined manually usingObject.defineProperty
which 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:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript