Skip to content

Commit 0301748

Browse files
committed
fix(NODE-6259): replace dynamic property assignment with a static getter
1 parent 52b8593 commit 0301748

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/bulk/common.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,6 @@ export class BulkWriteShimOperation extends AbstractOperation {
911911
/** @public */
912912
export abstract class BulkOperationBase {
913913
isOrdered: boolean;
914-
// Declare dynamically assigned property
915-
declare length: number;
916914
/** @internal */
917915
s: BulkOperationPrivate;
918916
operationId?: number;
@@ -1180,6 +1178,10 @@ export abstract class BulkOperationBase {
11801178
);
11811179
}
11821180

1181+
get length(): number {
1182+
return this.s.currentIndex;
1183+
}
1184+
11831185
get bsonOptions(): BSONSerializeOptions {
11841186
return this.s.bsonOptions;
11851187
}
@@ -1276,13 +1278,6 @@ export abstract class BulkOperationBase {
12761278
}
12771279
}
12781280

1279-
Object.defineProperty(BulkOperationBase.prototype, 'length', {
1280-
enumerable: true,
1281-
get() {
1282-
return this.s.currentIndex;
1283-
}
1284-
});
1285-
12861281
function isInsertBatch(batch: Batch): boolean {
12871282
return batch.batchType === BatchType.INSERT;
12881283
}

0 commit comments

Comments
 (0)