]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/custom-typings.d.ts
Handle blacklist (#84)
[github/Chocobozzz/PeerTube.git] / client / src / custom-typings.d.ts
1 /* tslint: disable */
2
3 /*
4 * Custom Type Definitions
5 * When including 3rd party modules you also need to include the type definition for the module
6 * if they don't provide one within the module. You can try to install it with @types
7
8 npm install @types/node
9 npm install @types/lodash
10
11 * If you can't find the type definition in the registry we can make an ambient/global definition in
12 * this file for now. For example
13
14 declare module 'my-module' {
15 export function doesSomething(value: string): string;
16 }
17
18 * If you are using a CommonJS module that is using module.exports then you will have to write your
19 * types using export = yourObjectOrFunction with a namespace above it
20 * notice how we have to create a namespace that is equal to the function we're
21 * assigning the export to
22
23 declare module 'jwt-decode' {
24 function jwtDecode(token: string): any;
25 namespace jwtDecode {}
26 export = jwtDecode;
27 }
28
29 *
30 * If you're prototying and you will fix the types later you can also declare it as type any
31 *
32
33 declare var assert: any;
34 declare var _: any;
35 declare var $: any;
36
37 *
38 * If you're importing a module that uses Node.js modules which are CommonJS you need to import as
39 * in the files such as main.browser.ts or any file within app/
40 *
41
42 import * as _ from 'lodash'
43
44 * You can include your type definitions in this file until you create one for the @types
45 *
46 */
47
48 // support NodeJS modules without type definitions
49 declare module '*';
50
51 /*
52 // for legacy tslint etc to understand rename 'modern-lru' with your package
53 // then comment out `declare module '*';`. For each new module copy/paste
54 // this method of creating an `any` module type definition
55 declare module 'modern-lru' {
56 let x: any;
57 export = x;
58 }
59 */
60
61 // Extra variables that live on Global that will be replaced by webpack DefinePlugin
62 declare var ENV: string;
63 declare var API_URL: string;
64 declare var HMR: boolean;
65 declare var System: SystemJS;
66
67 interface SystemJS {
68 import: (path?: string) => Promise<any>;
69 }
70
71 interface GlobalEnvironment {
72 ENV: string;
73 API_URL: string;
74 HMR: boolean;
75 SystemJS: SystemJS;
76 System: SystemJS;
77 }
78
79 interface Es6PromiseLoader {
80 (id: string): (exportName?: string) => Promise<any>;
81 }
82
83 type FactoryEs6PromiseLoader = () => Es6PromiseLoader;
84 type FactoryPromise = () => Promise<any>;
85
86 type AsyncRoutes = {
87 [component: string]: Es6PromiseLoader |
88 Function |
89 FactoryEs6PromiseLoader |
90 FactoryPromise ;
91 };
92
93 type IdleCallbacks = Es6PromiseLoader |
94 Function |
95 FactoryEs6PromiseLoader |
96 FactoryPromise ;
97
98 interface WebpackModule {
99 hot: {
100 data?: any,
101 idle: any,
102 accept(dependencies?: string | string[], callback?: (updatedDependencies?: any) => void): void;
103 decline(deps?: any | string | string[]): void;
104 dispose(callback?: (data?: any) => void): void;
105 addDisposeHandler(callback?: (data?: any) => void): void;
106 removeDisposeHandler(callback?: (data?: any) => void): void;
107 check(autoApply?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
108 apply(options?: any, callback?: (err?: Error, outdatedModules?: any[]) => void): void;
109 status(callback?: (status?: string) => void): void | string;
110 removeStatusHandler(callback?: (status?: string) => void): void;
111 };
112 }
113
114 interface WebpackRequire {
115 (id: string): any;
116 (paths: string[], callback: (...modules: any[]) => void): void;
117 ensure(ids: string[], callback: (req: WebpackRequire) => void, chunkName?: string): void;
118 context(directory: string, useSubDirectories?: boolean, regExp?: RegExp): WebpackContext;
119 }
120
121 interface WebpackContext extends WebpackRequire {
122 keys(): string[];
123 }
124
125 interface ErrorStackTraceLimit {
126 stackTraceLimit: number;
127 }
128
129 // Extend typings
130 interface NodeRequire extends WebpackRequire {}
131 interface ErrorConstructor extends ErrorStackTraceLimit {}
132 interface NodeRequireFunction extends Es6PromiseLoader {}
133 interface NodeModule extends WebpackModule {}
134 interface Global extends GlobalEnvironment {}