Skip to content

Commit

Permalink
types: re-export DeleteResult and UpdateResult from MongoDB Node.js d…
Browse files Browse the repository at this point in the history
…river

Fix #14946
  • Loading branch information
vkarpov15 committed Oct 9, 2024
1 parent 02c5efd commit 68418d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/types/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import mongoose, {
UpdateWriteOpResult,
AggregateOptions,
WithLevel1NestedPaths,
NestedPaths,
InferSchemaType
InferSchemaType,
DeleteResult
} from 'mongoose';
import { expectAssignable, expectError, expectType } from 'tsd';
import { AutoTypedSchemaType, autoTypedSchema } from './schema.test';
Expand Down Expand Up @@ -514,7 +514,7 @@ function gh12100() {
function modelRemoveOptions() {
const cmodel = model('Test', new Schema());

cmodel.deleteOne({}, {});
const res: DeleteResult = await cmodel.deleteOne({}, {});
}

async function gh12286() {
Expand Down
2 changes: 2 additions & 0 deletions types/models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ declare module 'mongoose' {
};

type UpdateWriteOpResult = mongodb.UpdateResult;
export type UpdateResult = mongodb.UpdateResult;
export type DeleteResult = mongodb.DeleteResult;

interface MapReduceOptions<T, K, R> {
map: Function | string;
Expand Down

0 comments on commit 68418d8

Please sign in to comment.