##// END OF EJS Templates
sync
sync

File last commit:

r117:6149d2260004 ioc ts support
r117:6149d2260004 ioc ts support
Show More
config.ts
38 lines | 1.0 KiB | video/mp2t | TypeScriptLexer
cin
dependency builder proposal
r110 import { Foo } from "./Foo";
import { Bar } from "./Bar";
import { Box } from "./Box";
cin
sync
r116 import { primitive } from "../safe";
import { Constructor } from "../interfaces";
cin
Working on IoC container configuration
r111
cin
sync
r116 interface Services {
cin
dependency builder proposal
r110 foo: Foo;
bar: Bar;
cin
sync
r116 box: Box<Foo>;
host: string;
cin
dependency builder proposal
r110
cin
sync
r116 }
cin
dependency builder proposal
r110
cin
sync
r116 interface TypeDescriptor<T, C extends Constructor<T>> {
$type: C;
params: Wrap<ConstructorParameters<C>>;
cin
dependency builder proposal
r110 }
cin
sync
r116 function typeRegistration<T, C extends Constructor<T>>(target: C, params: Wrap<ConstructorParameters<C>>): TypeDescriptor<T, C> {
throw new Error();
}
cin
Working on IoC container configuration
r111
cin
sync
r117 declare function register<T>(): { type<C extends Constructor<T>>(target: C, params: Wrap<ConstructorParameters<C>>): TypeDescriptor<T, C>};
cin
sync
r116 type Wrap<T> = T extends primitive ? T :
{ [k in keyof T]: Wrap<T[k]> } | TypeDescriptor<T, Constructor<T>>;
cin
Working on IoC container configuration
r111
cin
sync
r116 const config: Wrap<Services> = {
foo: typeRegistration(Foo, []),
bar: typeRegistration(Bar, [{ foo: null as any, nested: null as any }]),
cin
sync
r117 box: register<Box<Foo>>().type(Box, [{ $type: Bar, params: [] }]),
cin
sync
r116 host: ""
cin
Working on IoC container configuration
r111 };