From 69f3570de591373f1582aa67dc4580c61deebd45 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Sun, 7 May 2017 18:55:44 -0600 Subject: [PATCH] Fixed the TypeScript declaration file to property merge the Transports interface to include the MongoDB property. Installed @types/winston TypeScript declaration file dependency and resolves #97. --- lib/winston-mongodb.d.ts | 19 ++++++++++++++++--- package.json | 31 ++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/lib/winston-mongodb.d.ts b/lib/winston-mongodb.d.ts index 6032eb0..5a45989 100644 --- a/lib/winston-mongodb.d.ts +++ b/lib/winston-mongodb.d.ts @@ -1,7 +1,20 @@ // Type definitions for winston-mongodb // Project: https://github.com/winstonjs/winston-mongodb -// Definitions by: miton18 +// Definitions by: miton18 , blove -declare module 'winston-mongodb' { - export function MongoDB(options: Object): any; +/// + +import { TransportInstance, Transports, Winston } from "winston"; + +declare namespace winston { + export interface Winston { + transports: WinstonMongoDBTransports; + } + export interface MongoDBTransportInstance extends TransportInstance {} + export interface WinstonMongoDBTransports extends Transports { + MongoDB: MongoDBTransportInstance; + } } + +declare const winston: winston.Winston; +export = winston; diff --git a/package.json b/package.json index 6bcaa29..183ea51 100644 --- a/package.json +++ b/package.json @@ -5,23 +5,44 @@ "description": "A MongoDB transport for winston", "author": "Charlie Robbins ", "contributors": [ - {"name": "Yurij Mikhalevich", "email": "0@39.yt", "url": "https://39.yt/"}, - {"name": "Kendrick Taylor", "email": "sktayloriii@gmail.com"}, - {"name": "Steve Dalby", "email": "steve@stevedalby.co.uk"} + { + "name": "Yurij Mikhalevich", + "email": "0@39.yt", + "url": "https://39.yt/" + }, + { + "name": "Kendrick Taylor", + "email": "sktayloriii@gmail.com" + }, + { + "name": "Steve Dalby", + "email": "steve@stevedalby.co.uk" + } ], "repository": { "type": "git", "url": "http://github.com/indexzero/winston-mongodb.git" }, - "keywords": ["logging", "sysadmin", "tools", "winston", "mongodb", "log", "logger"], + "keywords": [ + "logging", + "sysadmin", + "tools", + "winston", + "mongodb", + "log", + "logger" + ], "dependencies": { + "@types/winston": "^2.3.2", "mongodb": "^2.2.19" }, "devDependencies": { "winston": ">=1.1.1 <3.0.0", "vows": "~0.8.1" }, - "engines": {"node" : ">=6.8.1"}, + "engines": { + "node": ">=6.8.1" + }, "main": "./lib/winston-mongodb", "scripts": { "test": "vows test/*-test.js --spec",