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; host: string; } interface TypeDescriptor> { $type: C; params: Wrap>; } function typeRegistration>(target: C, params: Wrap>): TypeDescriptor { throw new Error(); } declare function register(): { type>(target: C, params: Wrap>): TypeDescriptor}; type Wrap = T extends primitive ? T : { [k in keyof T]: Wrap } | TypeDescriptor>; const config: Wrap = { foo: typeRegistration(Foo, []), bar: typeRegistration(Bar, [{ foo: null as any, nested: null as any }]), box: register>().type(Box, [{ $type: Bar, params: [] }]), host: "" };