Type Alias InjectableFunction<Services, Tokens, Token, Service>

InjectableFunction<Services, Tokens, Token, Service>: Tokens extends readonly ValidTokens<Services>[]
    ? {
        dependencies: Tokens;
        token: Token;
        (...args: AsTuple<CorrespondingServices<Services, Tokens<Tokens>>>): Service;
    }
    : never

A valid InjectableFunction is one that can be successfully called, given some Services, to return a new Service. That is, it must satisfy two conditions:

  1. All the Tokens it specifies as dependencies are valid given the Services (i.e. they are either the Container Token or keys of the Services type).
  2. The function argument types correspond to the Services specified by the dependency Tokens.

A InjectableFunction also includes its own key Token and dependency Tokens as metadata, so it may be resolved by Container later.

Type Parameters

  • Services
  • Tokens
  • Token extends TokenType
  • Service