mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Fixed test case to a real world scenario, and subsequently fixed type definition
This commit is contained in:
+6
@@ -4,6 +4,12 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="mongoose" />
|
||||
|
||||
declare module 'mongoose-simple-random' {
|
||||
import mongoose = require('mongoose');
|
||||
var _: (schema: mongoose.Schema) => void;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "mongoose" {
|
||||
interface Model<T extends Document> extends NodeJS.EventEmitter, ModelProperties {
|
||||
findRandom(conditions: Object, projection?: Object | null, options?: Object | null, callback?: (err: any, res: T[]) => void)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongoose_simple_random from "mongoose-simple-random";
|
||||
|
||||
// test compatibility with other libraries - from @types/mongoose
|
||||
import * as _ from 'lodash';
|
||||
@@ -13,3 +14,5 @@ mongoose.Model.findRandom({
|
||||
}, {}, { limit: 1 }, (error, data) => {
|
||||
if (error) { console.error("Error!"); } else { console.log("Success!"); }
|
||||
});
|
||||
|
||||
mongoose.plugin(mongoose_simple_random);
|
||||
|
||||
Reference in New Issue
Block a user