aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/custom-typings.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/custom-typings.d.ts')
-rw-r--r--client/src/custom-typings.d.ts119
1 files changed, 119 insertions, 0 deletions
diff --git a/client/src/custom-typings.d.ts b/client/src/custom-typings.d.ts
new file mode 100644
index 000000000..14c7d8ade
--- /dev/null
+++ b/client/src/custom-typings.d.ts
@@ -0,0 +1,119 @@
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
6typings install node --save
7
8 * If you can't find the type definition in the registry we can make an ambient definition in
9 * this file for now. For example
10
11declare module "my-module" {
12 export function doesSomething(value: string): string;
13}
14
15 *
16 * If you're prototying and you will fix the types later you can also declare it as type any
17 *
18
19declare var assert: any;
20
21 *
22 * If you're importing a module that uses Node.js modules which are CommonJS you need to import as
23 *
24
25import * as _ from 'lodash'
26
27 * You can include your type definitions in this file until you create one for the typings registry
28 * see https://github.com/typings/registry
29 *
30 */
31
32
33// Extra variables that live on Global that will be replaced by webpack DefinePlugin
34declare var ENV: string;
35declare var HMR: boolean;
36interface GlobalEnvironment {
37 ENV;
38 HMR;
39}
40
41interface WebpackModule {
42 hot: {
43 data?: any,
44 idle: any,
45 accept(dependencies?: string | string[], callback?: (updatedDependencies?: any) => void): void;
46 decline(dependencies?: string | string[]): void;
47 dispose(callback?: (data?: any) => void): void;
48 addDisposeHandler(callback?: (data?: any) => void): void;
49 removeDisposeHandler(callback?: (data?: any) => void): void;
50 check(autoApply?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
51 apply(options?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
52 status(callback?: (status?: string) => void): void | string;
53 removeStatusHandler(callback?: (status?: string) => void): void;
54 };
55}
56
57interface WebpackRequire {
58 context(file: string, flag?: boolean, exp?: RegExp): any;
59}
60
61
62interface ErrorStackTraceLimit {
63 stackTraceLimit: number;
64}
65
66
67
68// Extend typings
69interface NodeRequire extends WebpackRequire {}
70interface ErrorConstructor extends ErrorStackTraceLimit {}
71interface NodeModule extends WebpackModule {}
72interface Global extends GlobalEnvironment {}
73
74
75declare namespace Reflect {
76 function decorate(decorators: ClassDecorator[], target: Function): Function;
77 function decorate(
78 decorators: (PropertyDecorator | MethodDecorator)[],
79 target: Object,
80 targetKey: string | symbol,
81 descriptor?: PropertyDescriptor): PropertyDescriptor;
82
83 function metadata(metadataKey: any, metadataValue: any): {
84 (target: Function): void;
85 (target: Object, propertyKey: string | symbol): void;
86 };
87 function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
88 function defineMetadata(
89 metadataKey: any,
90 metadataValue: any,
91 target: Object,
92 targetKey: string | symbol): void;
93 function hasMetadata(metadataKey: any, target: Object): boolean;
94 function hasMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
95 function hasOwnMetadata(metadataKey: any, target: Object): boolean;
96 function hasOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
97 function getMetadata(metadataKey: any, target: Object): any;
98 function getMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
99 function getOwnMetadata(metadataKey: any, target: Object): any;
100 function getOwnMetadata(metadataKey: any, target: Object, targetKey: string | symbol): any;
101 function getMetadataKeys(target: Object): any[];
102 function getMetadataKeys(target: Object, targetKey: string | symbol): any[];
103 function getOwnMetadataKeys(target: Object): any[];
104 function getOwnMetadataKeys(target: Object, targetKey: string | symbol): any[];
105 function deleteMetadata(metadataKey: any, target: Object): boolean;
106 function deleteMetadata(metadataKey: any, target: Object, targetKey: string | symbol): boolean;
107}
108
109
110// We need this here since there is a problem with Zone.js typings
111interface Thenable<T> {
112 then<U>(
113 onFulfilled?: (value: T) => U | Thenable<U>,
114 onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
115 then<U>(
116 onFulfilled?: (value: T) => U | Thenable<U>,
117 onRejected?: (error: any) => void): Thenable<U>;
118 catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
119}