interfaces.ts
21 lines
| 644 B
| video/mp2t
|
TypeScriptLexer
|
|
r49 | import { ActivationContext } from "./ActivationContext"; | ||
|
|
r115 | export interface Descriptor<S = any, T = any> { | ||
| activate(context: ActivationContext<S>): T; | ||||
|
|
r49 | } | ||
|
|
r118 | export type ServiceMap<S> = { | ||
| [k in keyof S]: Descriptor<S, S[k]>; | ||||
|
|
r115 | }; | ||
|
|
r118 | export type PartialServiceMap<S> = { | ||
| [k in keyof S]?: Descriptor<S, S[k]>; | ||||
| }; | ||||
|
|
r115 | |||
| export interface Resolver<S> { | ||||
| resolve<K extends keyof ContainerServices<S>, T extends ContainerServices<S>[K] = ContainerServices<S>[K]>(name: K, def?: T): T; | ||||
| } | ||||
| export type ContainerServices<S> = S & { | ||||
| container: Resolver<S>; | ||||
| }; | ||||
|
|
r118 | export type ActivationType = "singleton" | "container" | "hierarchy" | "context" | "call"; | ||
