diff --git a/rc/index.d.ts b/rc/index.d.ts index 113f9cdda2..9a2c6783f6 100644 --- a/rc/index.d.ts +++ b/rc/index.d.ts @@ -6,7 +6,8 @@ declare function rc( name: string, defaults?: any, - argv?: string[] | null, - parse?: ((content: string) => any) | null): any; + argv?: {} | null, + parse?: ((content: string) => any) | null +): any; export = rc; \ No newline at end of file diff --git a/rc/rc-tests.ts b/rc/rc-tests.ts index 9b47bb18d4..9574bec339 100644 --- a/rc/rc-tests.ts +++ b/rc/rc-tests.ts @@ -1,16 +1,33 @@ import rc = require("rc") -let confA = rc("appname", { +let confA = rc("appname1", { port: 2468, - views: { engine: "jade" } }); -let appCfg = rc("appname", {}, null, function parse(s) { +//////////////////// + +let appCfg = rc("appname2", {}, null, function parse(s) { return JSON.parse(s.toLowerCase()); }); + appCfg.configs[0]; appCfg.configs[1]; -appCfg.config; \ No newline at end of file +appCfg.config; + +//////////////////// + +let customArgv = rc("appname3", { + option: true +}, +{ + option: false, + envOption: 24, + argv: { + remain: [], + cooked: ['--no-option', '--envOption', '24'], + original: ['--no-option', '--envOption=24'] + } +});