UNPKG

2.12 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/rc`
3
4# Summary
5This package contains type definitions for rc (https://github.com/dominictarr/rc).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rc.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rc/index.d.ts)
10````ts
11// Type definitions for rc 1.2
12// Project: https://github.com/dominictarr/rc
13// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
14// BendingBender <https://github.com/BendingBender>
15// kusyka911 <https://github.com/kusyka911>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17// TypeScript Version: 2.2
18
19interface RcResultType<T> {
20 /**
21 * Contains all parsed configurations from different sources
22 * like '/etc/${appname}rc', '/etc/${appname}/config', and other.
23 */
24 configs: T[];
25 /**
26 * same as RcResultType.configs[RcResultType.configs.length - 1]
27 */
28 config: T;
29 /**
30 * For compatibility with previous versions of '@types/rc'
31 */
32 [key: string]: any;
33}
34
35declare function rc<T extends object = { [key: string]: any }>(
36 name: string,
37 defaults?: T,
38 /**
39 * Parsed argv object. For example, if args is `--foo bar`, then this value should be `{foo: 'bar'}`
40 * If `argv` is `null` or `undefined`, then `rc`'s default parser will parse `process.argv`.
41 */
42 argv?: T | null,
43 /**
44 * Custom config file parser.
45 * This function will be passed the string contents of each
46 * discovered configuration file should return a parsed object dictionary.
47 */
48 parse?: ((content: string) => { [key: string]: any }) | null
49): T & RcResultType<T>;
50
51export = rc;
52
53````
54
55### Additional Details
56 * Last updated: Tue, 17 Aug 2021 13:01:24 GMT
57 * Dependencies: none
58 * Global values: none
59
60# Credits
61These definitions were written by [Daniel Rosenwasser](https://github.com/DanielRosenwasser), [BendingBender](https://github.com/BendingBender), and [kusyka911](https://github.com/kusyka911).
62
\No newline at end of file