From 41df2ed0f79ce72b4bc9d1cbcf5725703484dff2 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Tue, 9 May 2017 09:48:18 +0100 Subject: [PATCH] Added types for mongoose-unique-validator --- types/mongoose-unique-validator/index.d.ts | 13 +++++++++++ .../mongoose-unique-validator-tests.ts | 8 +++++++ types/mongoose-unique-validator/tsconfig.json | 22 +++++++++++++++++++ types/mongoose-unique-validator/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/mongoose-unique-validator/index.d.ts create mode 100644 types/mongoose-unique-validator/mongoose-unique-validator-tests.ts create mode 100644 types/mongoose-unique-validator/tsconfig.json create mode 100644 types/mongoose-unique-validator/tslint.json diff --git a/types/mongoose-unique-validator/index.d.ts b/types/mongoose-unique-validator/index.d.ts new file mode 100644 index 0000000000..3cc2a13d80 --- /dev/null +++ b/types/mongoose-unique-validator/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for mongoose-unique-validator 1.0 +// Project: https://github.com/blakehaswell/mongoose-unique-validator#readme +// Definitions by: Steve Hipwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Schema } from "mongoose"; + +export = mongooseUniqueValidator; + +declare function mongooseUniqueValidator(schema: Schema, options?: any): void; + +declare namespace mongooseUniqueValidator { +} diff --git a/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts b/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts new file mode 100644 index 0000000000..59ada92a3c --- /dev/null +++ b/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts @@ -0,0 +1,8 @@ +import { Schema } from "mongoose"; +import * as uniqueValidator from "mongoose-unique-validator"; + +const schema = new Schema({ + test: { type: String } +}); + +schema.plugin(uniqueValidator); diff --git a/types/mongoose-unique-validator/tsconfig.json b/types/mongoose-unique-validator/tsconfig.json new file mode 100644 index 0000000000..069b7515ff --- /dev/null +++ b/types/mongoose-unique-validator/tsconfig.json @@ -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-unique-validator-tests.ts" + ] +} diff --git a/types/mongoose-unique-validator/tslint.json b/types/mongoose-unique-validator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mongoose-unique-validator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }