From 8b6a0421e125e10ae0b18af87229e0a9fdc29173 Mon Sep 17 00:00:00 2001 From: Christian Eikermann Date: Fri, 4 Mar 2016 21:25:03 +0100 Subject: [PATCH] Add interface to module "config" At the moment there is no interface for the config functions --- config/config-tests.ts | 4 +++- config/config.d.ts | 50 +++++++++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/config/config-tests.ts b/config/config-tests.ts index 2f53b76d6..9525a582e 100644 --- a/config/config-tests.ts +++ b/config/config-tests.ts @@ -1,6 +1,8 @@ /// -import config = require('config'); +import * as config from "config"; + +var class1: config.IConfig = config; var value1: string = config.get(""); var value2: any = config.get(""); diff --git a/config/config.d.ts b/config/config.d.ts index c37eddae9..939d1f3e5 100644 --- a/config/config.d.ts +++ b/config/config.d.ts @@ -4,31 +4,41 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "config" { - // see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities - interface IUtil { - // Extend an object (and any object it contains) with one or more objects (and objects contained in them). - extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any; - // Return a deep copy of the specified object. - cloneDeep(copyFrom: any, depth?: number): any; + var c: c.IConfig; - // Return true if two objects have equal contents. - equalsDeep(object1: any, object2: any, dept?: number): boolean; + module c { - // Returns an object containing all elements that differ between two objects. - diffDeep(object1: any, object2: any, depth?: number): any; + // see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities + interface IUtil { + // Extend an object (and any object it contains) with one or more objects (and objects contained in them). + extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any; - // Make a javascript object property immutable (assuring it cannot be changed from the current value). - makeImmutable(object: any, propertyName?: string, propertyValue?: string): any; + // Return a deep copy of the specified object. + cloneDeep(copyFrom: any, depth?: number): any; - // Make an object property hidden so it doesn't appear when enumerating elements of the object. - makeHidden(object: any, propertyName: string, propertyValue?: string): any; + // Return true if two objects have equal contents. + equalsDeep(object1: any, object2: any, dept?: number): boolean; - // Get the current value of a config environment variable - getEnv(varName: string): string; - } + // Returns an object containing all elements that differ between two objects. + diffDeep(object1: any, object2: any, depth?: number): any; - export function get(setting: string): T; - export function has(setting: string): boolean; - export var util: IUtil; + // Make a javascript object property immutable (assuring it cannot be changed from the current value). + makeImmutable(object: any, propertyName?: string, propertyValue?: string): any; + + // Make an object property hidden so it doesn't appear when enumerating elements of the object. + makeHidden(object: any, propertyName: string, propertyValue?: string): any; + + // Get the current value of a config environment variable + getEnv(varName: string): string; + } + + interface IConfig { + get(setting: string): T; + has(setting: string): boolean; + util: IUtil; + } + } + + export = c; }