-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
40 lines (34 loc) · 1.12 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as Application from 'koa';
import * as Router from 'koa-router';
declare interface DependencyConfig {
name: string,
strategy: 'service' | 'factory' | 'singleton' | 'value' | 'constant' | 'alias',
value: any
}
declare class Injector {
constructor(module: Module)
resolve(dependencyName: string): any
addImports(dependencies: any)
register(...dependencies: DependencyConfig[])
getConfigOf(dependencyName: string): DependencyConfig
}
declare interface ModuleConfig {
name: string,
declarations?: DependencyConfig[],
imports?: Module[],
exports?: string | string[]
}
declare class Module {
constructor(config: Module)
static createModule(config: ModuleConfig): Module
}
declare class DI {
constructor();
module(config: Module | ModuleConfig): Module
bootstrap(config: Module | ModuleConfig)
resolve(dependencyName: string): any
static create(): DI
static integrateWith(app: any): any
}
export function koaDI(bootstrapModule: Module | ModuleConfig, app: Application, router?: Router): undefined
export function createModule(config: ModuleConfig): Module