Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions types/mongodb/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2439,10 +2439,8 @@ export interface GridFSBucketOptions {
readPreference?: ReadPreferenceOrMode;
}

/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#~errorCallback */
export interface GridFSBucketErrorCallback {
(err?: MongoError): void;
}
/** http://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucket.html#~errorCallback */
export interface GridFSBucketErrorCallback extends MongoCallback<void> {}

/** http://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucket.html#find */
export interface GridFSBucketFindOptions {
Expand Down Expand Up @@ -2487,7 +2485,7 @@ export class GridFSBucketWriteStream extends Writable {
* @param [callback] called when chunks are successfully removed or error occurred
* @see {@link https://mongodb.github.io/node-mongodb-native/3.6/api/GridFSBucketWriteStream.html#abort}
*/
abort(callback?: () => void): void;
abort(callback?: GridFSBucketErrorCallback): void;
}

/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketWriteStream.html */
Expand Down
6 changes: 5 additions & 1 deletion types/mongodb/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ const gridFSBucketTests = (bucket: mongodb.GridFSBucket) => {
const openUploadStream = bucket.openUploadStream('file.dat');
openUploadStream.on('close', () => {});
openUploadStream.on('end', () => {});
openUploadStream.abort(); // $ExpectType void
openUploadStream.abort(() => {
openUploadStream.removeAllListeners();
});
openUploadStream.abort();
openUploadStream.abort((error) => {
error; // $ExpectType MongoError
});
openUploadStream.abort((error, result) => {});
};

// Compression
Expand Down