UNPKG

1.13 kBTypeScriptView Raw
1// Type definitions for module-alias 2.0
2// Project: https://github.com/ilearnio/module-alias/
3// Definitions by: Kevin Ramharak <https://github.com/KevinRamharak>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6export = init;
7
8/**
9 * Import aliases from package.json
10 */
11declare function init(options?: string | init.Options): void;
12
13/**
14 * Exported functoins
15 */
16declare namespace init {
17 function isPathMatchesAlias(path: string, alias: string): boolean;
18
19 /**
20 * Register a custom modules directory
21 */
22 function addPath(path: string): void;
23
24 /**
25 * Register a single alias
26 */
27 function addAlias(alias: string, path: string): void;
28
29 /**
30 * Register mutliple aliases
31 */
32 function addAliases(aliases: { [alias: string]: string }): void;
33
34 /**
35 * Reset any changes maded (resets all registered aliases
36 * and custom module directories)
37 * The function is undocumented and for testing purposes only
38 */
39 function reset(): void;
40
41 /**
42 * module intialis options type
43 */
44 interface Options {
45 base: string;
46 }
47}