##// END OF EJS Templates
added provided and configure methods to the fluent container configuration, added applyConfig method to the container
added provided and configure methods to the fluent container configuration, added applyConfig method to the container

File last commit:

r142:be7edf08a115 v1.4.0-rc3 default
r142:be7edf08a115 v1.4.0-rc3 default
Show More
interfaces.ts
57 lines | 2.3 KiB | video/mp2t | TypeScriptLexer
/ src / main / ts / di / fluent / interfaces.ts
cin
working on fluent container configuration
r125 import { primitive } from "../../safe";
cin
Completely removed IoC annotations...
r135 import { TypeOfService, ContainerKeys, ActivationType, ILifetime } from "../interfaces";
import { ICancellation } from "../../interfaces";
cin
added provided and configure methods to the fluent container configuration, added applyConfig method to the container
r142 import { Container } from "../Container";
cin
working on fluent container configuration
r125
cin
working on fluent configuration
r133 export interface DependencyOptions {
cin
fluent configuration interfaces
r127 optional?: boolean;
cin
working on fluent configuration
r133 default?: any;
cin
fluent configuration interfaces
r127 }
cin
working on fluent container configuration
r125
cin
working on fluent configuration
r133 export interface LazyDependencyOptions extends DependencyOptions {
cin
fluent configuration interfaces
r127 lazy: true;
}
cin
working on fluent configuration
r133 export type ExtractService<K, S> = K extends keyof S ? S[K] : never;
cin
fluent configuration interfaces
r127
export type ExtractDependency<D, S> = D extends { $dependency: infer K } ?
cin
working on fluent container configuration
r125 D extends { lazy: true } ? () => ExtractService<K, S> : ExtractService<K, S> :
D extends { $type: new (...args: any[]) => infer I } ? I :
D extends { $factory: (...args: any[]) => infer R } ? R :
WalkDependencies<D, S>;
cin
fluent configuration interfaces
r127 export type WalkDependencies<D, S> = D extends primitive ? D :
cin
working on fluent container configuration
r125 { [K in keyof D]: ExtractDependency<D[K], S> };
cin
working on fluent configuration, di annotations removed
r134 export type InferReferenceType<S extends object, K extends ContainerKeys<S>, O> = O extends { default: infer X } ? (TypeOfService<S, K> | X) :
cin
working on fluent configuration
r133 O extends { optional: true } ? (TypeOfService<S, K> | undefined) :
TypeOfService<S, K>;
export interface Resolver<S extends object> {
cin
working on fluent configuration, di annotations removed
r134 <K extends ContainerKeys<S>, O extends LazyDependencyOptions>(this: void, name: K, opts: O): () => InferReferenceType<S, K, O>;
<K extends ContainerKeys<S>, O extends DependencyOptions>(this: void, name: K, opts?: O): InferReferenceType<S, K, O>;
cin
working on fluent configuration
r128 }
cin
Completely removed IoC annotations...
r135 export interface DescriptorBuilder<S extends object, T> {
factory(f: (resolve: Resolver<S>) => T): void;
build<T2>(): DescriptorBuilder<S, T2>;
cin
working on fluent configuration
r128
cin
Completely removed IoC annotations...
r135 override<K extends keyof S>(name: K, builder: RegistrationBuilder<S, S[K]>): this;
override<K extends keyof S>(services: { [name in K]: RegistrationBuilder<S, S[K]> }): this;
lifetime(lifetime: "singleton", typeId: any): this;
lifetime(lifetime: ILifetime | Exclude<ActivationType, "singleton">): this;
cleanup(cb: (item: T) => void): this;
cin
working on fluent configuration
r128
cin
working on fluent configuration
r133 value(v: T): void;
cin
working on fluent container configuration
r125 }
cin
added provided and configure methods to the fluent container configuration, added applyConfig method to the container
r142 export interface ContainerConfiguration<S extends object> {
apply<S2 extends object>(target: Container<S2>, ct: ICancellation): Promise<Container<S2 & S>>;
}
cin
Completely removed IoC annotations...
r135 export type RegistrationBuilder<S extends object, T> = (d: DescriptorBuilder<S, T>, ct?: ICancellation) => void | Promise<void>;
export type FluentRegistrations<K extends keyof S, S extends object> = { [k in K]: RegistrationBuilder<S, S[k]> };