##// END OF EJS Templates
sync
sync

File last commit:

r116:e81085d00fcb ioc ts support
r116:e81085d00fcb ioc ts support
Show More
config.ts
36 lines | 875 B | video/mp2t | TypeScriptLexer
import { Foo } from "./Foo";
import { Bar } from "./Bar";
import { Box } from "./Box";
import { primitive } from "../safe";
import { Constructor } from "../interfaces";
interface Services {
foo: Foo;
bar: Bar;
box: Box<Foo>;
host: string;
}
interface TypeDescriptor<T, C extends Constructor<T>> {
$type: C;
params: Wrap<ConstructorParameters<C>>;
}
function typeRegistration<T, C extends Constructor<T>>(target: C, params: Wrap<ConstructorParameters<C>>): TypeDescriptor<T, C> {
throw new Error();
}
type Wrap<T> = T extends primitive ? T :
{ [k in keyof T]: Wrap<T[k]> } | TypeDescriptor<T, Constructor<T>>;
const config: Wrap<Services> = {
foo: typeRegistration(Foo, []),
bar: typeRegistration(Bar, [{ foo: null as any, nested: null as any }]),
box: typeRegistration(Box, [{ $type: Bar, params: [] }]),
host: ""
};