mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Created type definition & wrote test case
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for mongoose-simple-random 0.4
|
||||
// Project: https://github.com/larryprice/mongoose-simple-random
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="mongoose" />
|
||||
|
||||
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)
|
||||
: void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as mongoose from 'mongoose';
|
||||
|
||||
// test compatibility with other libraries - from @types/mongoose
|
||||
import * as _ from 'lodash';
|
||||
import * as fs from "fs";
|
||||
|
||||
mongoose.Model.findRandom({
|
||||
username: { $ne: "DummyUser" },
|
||||
rating: {
|
||||
$gt: 1,
|
||||
$lt: 11,
|
||||
},
|
||||
}, {}, { limit: 1 }, (error, data) => {
|
||||
if (error) { console.error("Error!"); } else { console.log("Success!"); }
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mongoose-simple-random-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user