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+ // Extra variables that live on Global that will be replaced by webpack DefinePlugin
35+ declare var ENV : string ;
36+ declare var HMR : boolean ;
37+ declare var Zone : { current : any } ;
38+ interface GlobalEnvironment {
39+ ENV ;
40+ HMR ;
41+ }
42+
43+ interface WebpackModule {
44+ hot : {
45+ data ?: any ,
46+ idle : any ,
47+ accept ( dependencies ?: string | string [ ] , callback ?: ( updatedDependencies ?: any ) => void ) : void ;
48+ decline ( dependencies ?: string | string [ ] ) : void ;
49+ dispose ( callback ?: ( data ?: any ) => void ) : void ;
50+ addDisposeHandler ( callback ?: ( data ?: any ) => void ) : void ;
51+ removeDisposeHandler ( callback ?: ( data ?: any ) => void ) : void ;
52+ check ( autoApply ?: any , callback ?: ( err ?: Error , outdatedModules ?: any [ ] ) => void ) : void ;
53+ apply ( options ?: any , callback ?: ( err ?: Error , outdatedModules ?: any [ ] ) => void ) : void ;
54+ status ( callback ?: ( status ?: string ) => void ) : void | string ;
55+ removeStatusHandler ( callback ?: ( status ?: string ) => void ) : void ;
56+ } ;
57+ }
58+
59+ interface WebpackRequire {
60+ context ( file : string , flag ?: boolean , exp ?: RegExp ) : any ;
61+ }
62+
63+ // Extend typings
64+ interface NodeRequire extends WebpackRequire { }
65+ interface NodeModule extends WebpackModule { }
66+ interface Global extends GlobalEnvironment { }
0 commit comments