1
|
/*
|
2
|
* Custom Type Definitions
|
3
|
* When including 3rd party modules you also need to include the type definition for the module
|
4
|
* if they don't provide one within the module. You can try to install it with typings
|
5
|
typings install node --save
|
6
|
* If you can't find the type definition in the registry we can make an ambient definition in
|
7
|
* this file for now. For example
|
8
|
declare module "my-module" {
|
9
|
export function doesSomething(value: string): string;
|
10
|
}
|
11
|
*
|
12
|
* If you're prototying and you will fix the types later you can also declare it as type any
|
13
|
*
|
14
|
declare var assert: any;
|
15
|
*
|
16
|
* If you're importing a module that uses Node.js modules which are CommonJS you need to import as
|
17
|
*
|
18
|
import * as _ from 'lodash'
|
19
|
* You can include your type definitions in this file until you create one for the typings registry
|
20
|
* see https://github.com/typings/registry
|
21
|
*
|
22
|
*/
|
23
|
|
24
|
// declare module '*'; // default type definitions for any for modules that are not found.
|
25
|
// caveat: if this is enabled and you do not have the proper module there may not be an error.
|
26
|
// suggestion: follow the pattern below with modern-lru which provides an alternative way to create an 'any' module.
|
27
|
|
28
|
// for legacy tslint etc to understand
|
29
|
declare module 'modern-lru' {
|
30
|
let x: any;
|
31
|
export = x;
|
32
|
}
|
33
|
|
34
|
//declare var clipboard: any;
|
35
|
//import * as Clipboard from 'clipboard';
|
36
|
|
37
|
|
38
|
declare var System: SystemJS;
|
39
|
|
40
|
interface SystemJS {
|
41
|
import: (path?: string) => Promise<any>;
|
42
|
}
|
43
|
// Extra variables that live on Global that will be replaced by webpack DefinePlugin
|
44
|
declare var ENV: string;
|
45
|
declare var HMR: boolean;
|
46
|
declare var Zone: {current: any};
|
47
|
|
48
|
interface GlobalEnvironment {
|
49
|
ENV;
|
50
|
HMR;
|
51
|
SystemJS: SystemJS;
|
52
|
System: SystemJS;
|
53
|
}
|
54
|
|
55
|
interface WebpackModule {
|
56
|
hot: {
|
57
|
data?: any,
|
58
|
idle: any,
|
59
|
accept(dependencies?: string | string[], callback?: (updatedDependencies?: any) => void): void;
|
60
|
decline(dependencies?: string | string[]): void;
|
61
|
dispose(callback?: (data?: any) => void): void;
|
62
|
addDisposeHandler(callback?: (data?: any) => void): void;
|
63
|
removeDisposeHandler(callback?: (data?: any) => void): void;
|
64
|
check(autoApply?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
|
65
|
apply(options?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
|
66
|
status(callback?: (status?: string) => void): void | string;
|
67
|
removeStatusHandler(callback?: (status?: string) => void): void;
|
68
|
};
|
69
|
}
|
70
|
|
71
|
interface WebpackRequire {
|
72
|
context(file: string, flag?: boolean, exp?: RegExp): any;
|
73
|
}
|
74
|
|
75
|
// Extend typings
|
76
|
interface NodeRequire extends WebpackRequire {}
|
77
|
interface NodeModule extends WebpackModule {}
|
78
|
interface Global extends GlobalEnvironment {}
|