mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
[rc] Improve types (#31645)
This commit is contained in:
committed by
Wesley Wigham
parent
eeb54c4e39
commit
70eea52fa7
Vendored
+8
-6
@@ -1,22 +1,24 @@
|
||||
// Type definitions for rc
|
||||
// Type definitions for rc 1.1
|
||||
// Project: https://github.com/dominictarr/rc
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare function rc(
|
||||
name: string,
|
||||
defaults?: any,
|
||||
name: string,
|
||||
defaults?: { [key: string]: any },
|
||||
/**
|
||||
* Parsed argv object. For example, if args is `--foo bar`, then this value should be `{foo: 'bar'}`
|
||||
* If `argv` is `null` or `undefined`, then `rc`'s default parser will parse `process.argv`.
|
||||
*/
|
||||
argv?: {} | null,
|
||||
argv?: { [key: string]: any } | null,
|
||||
/**
|
||||
* Custom config file parser.
|
||||
* This function will be passed the string contents of each
|
||||
* discovered configuration file should return a parsed object dictionary.
|
||||
*/
|
||||
parse?: ((content: string) => any) | null
|
||||
): any;
|
||||
parse?: ((content: string) => { [key: string]: any }) | null
|
||||
): { [key: string]: any };
|
||||
|
||||
export = rc;
|
||||
|
||||
+19
-16
@@ -1,15 +1,15 @@
|
||||
import rc = require("rc")
|
||||
import rc = require('rc');
|
||||
|
||||
let confA = rc("appname1", {
|
||||
const confA = rc('appname1', {
|
||||
port: 2468,
|
||||
views: {
|
||||
engine: "jade"
|
||||
}
|
||||
engine: 'jade',
|
||||
},
|
||||
});
|
||||
|
||||
////////////////////
|
||||
|
||||
let appCfg = rc("appname2", {}, null, function parse(s) {
|
||||
const appCfg = rc('appname2', {}, null, function parse(s) {
|
||||
return JSON.parse(s.toLowerCase());
|
||||
});
|
||||
|
||||
@@ -19,15 +19,18 @@ appCfg.config;
|
||||
|
||||
////////////////////
|
||||
|
||||
let customArgv = rc("appname3", {
|
||||
option: true
|
||||
},
|
||||
{
|
||||
option: false,
|
||||
envOption: 24,
|
||||
argv: {
|
||||
remain: [],
|
||||
cooked: ['--no-option', '--envOption', '24'],
|
||||
original: ['--no-option', '--envOption=24']
|
||||
const customArgv = rc(
|
||||
'appname3',
|
||||
{
|
||||
option: true,
|
||||
},
|
||||
{
|
||||
option: false,
|
||||
envOption: 24,
|
||||
argv: {
|
||||
remain: [],
|
||||
cooked: ['--no-option', '--envOption', '24'],
|
||||
original: ['--no-option', '--envOption=24'],
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
+1
-77
@@ -1,79 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user