##// END OF EJS Templates
sync
sync

File last commit:

r126:142c5f6dc2b5 ioc ts support
r126:142c5f6dc2b5 ioc ts support
Show More
Annotations.ts
62 lines | 2.0 KiB | video/mp2t | TypeScriptLexer
/ src / main / ts / di / Annotations.ts
cin
configuration interfaces moved to di/Configuration module...
r118 import { primitive } from "../safe";
cin
working on container configuration dsl
r124 import { TypeRegistration, DependencyRegistration, LazyDependencyRegistration, Registration, StrictTypeRegistration } from "./Configuration";
cin
Initial work on typescript support for the container configuration
r107
export interface InjectOptions {
lazy?: boolean;
}
cin
configuration draft-1
r119 type Compatible<T1, T2> = T2 extends T1 ? any : never;
cin
working on di decorators
r109
cin
Working on IoC container configuration
r111 type ExtractService<K, S> = K extends keyof S ? S[K] : K;
cin
working on di decorators
r109
cin
configuration interfaces moved to di/Configuration module...
r118 type ExtractDependency<D, S> = D extends { $dependency: infer K } ?
D extends { lazy: true } ? () => ExtractService<K, S> : ExtractService<K, S> :
cin
working on container configuration dsl
r124 D extends { $type: new (...args: any[]) => infer I } ? I :
cin
configuration interfaces moved to di/Configuration module...
r118 WalkDependencies<D, S>;
cin
working on di decorators
r109
cin
configuration interfaces moved to di/Configuration module...
r118 type WalkDependencies<D, S> = D extends primitive ? D :
{ [K in keyof D]: ExtractDependency<D[K], S> };
cin
working on di decorators
r109
cin
improved interfaces and more tight type checking
r120 export class Builder<T, S extends object> {
cin
configuration draft-1
r119 declare<P extends any[]>(...args: P) {
cin
Working on IoC container configuration
r111 return <C extends new (...args: ExtractDependency<P, S>) => T>(constructor: C) => {
cin
improved interfaces and more tight type checking
r120
cin
dependency builder proposal
r108 };
}
cin
configuration interfaces moved to di/Configuration module...
r118 inject<P extends any[]>(...args: P) {
return <X extends { [m in M]: (...args: any) => any }, M extends keyof (T | X)>(
target: X,
memberName: M,
descriptor: TypedPropertyDescriptor<Compatible<(...args: ExtractDependency<P, S>) => any, T[M]>>
) => {
cin
dependency builder proposal
r108
};
}
cin
sync
r121 getDescriptor(): TypeRegistration<new () => T, S> {
cin
configuration interfaces moved to di/Configuration module...
r118 throw new Error();
}
cin
configuration draft-1
r119 }
cin
sync
r121 export interface DependencyOptions<T> {
optional?: boolean;
default?: T;
}
export interface LazyDependencyOptions<T> extends DependencyOptions<T> {
lazy: true;
}
cin
improved interfaces and more tight type checking
r120 interface Declaration<S extends object> {
cin
configuration draft-1
r119 define<T>(): Builder<T, S>;
cin
working on container configuration dsl
r124 dependency<K extends keyof S>(name: K, opts: LazyDependencyOptions<S[K]>): LazyDependencyRegistration<S, K>;
dependency<K extends keyof S>(name: K, opts?: DependencyOptions<S[K]>): DependencyRegistration<S, K>;
cin
working on fluent container configuration
r125 $type<T, P extends any[], C extends new (...args: ExtractDependency<P, S>) => T>(target: C, ...params: P): StrictTypeRegistration<C, S>;
cin
configuration draft-1
r119 }
cin
configuration interfaces moved to di/Configuration module...
r118
cin
sync
r123
cin
configuration draft-1
r119 export declare function declare<S extends object>(): Declaration<S>;