##// END OF EJS Templates
Working on IoC container configuration
cin -
r112:efce7387bfc8 ioc ts support
parent child
Show More
@@ -19,7 +19,7 type VisitDependency<D, S> = D extends {
19 19 export class Builder<T, S> {
20 20 consume<P extends any[]>(...args: P) {
21 21 return <C extends new (...args: ExtractDependency<P, S>) => T>(constructor: C) => {
22 // return constructor;
22 return constructor as typeof constructor & { service: () => T };
23 23 };
24 24 }
25 25
@@ -34,4 +34,8 export class Builder<T, S> {
34 34 };
35 35 }
36 36
37 cast<T2 extends T>(): Builder<T2, S> {
38 return this as Builder<T2, S>;
37 39 }
40
41 }
@@ -25,4 +25,4 export class Box<T> {
25 25
26 26 return this._value;
27 27 }
28 }
28 } No newline at end of file
@@ -61,7 +61,8 const t = {
61 61 timeout: Number
62 62 };
63 63
64 declare const bc: typeof Box;
65
66 const x = new bc();
67
64 68 export declare const config: ConfigBuilder<ContainerServices>;
65 config
66 .mapTo("bar", )
67 .mapTo("barBox", ;
General Comments 0
You need to be logged in to leave comments. Login now