Setu-TS
    Preparing search index...

    Function Inject

    • Declares the constructor injection tokens for a class, one per constructor argument in argument order. The DecoratorPlugin resolves each token (from the DI container or the service registry) and passes the results to the constructor.

      A token is always required: type-inferred injection needs emitDecoratorMetadata, which Deno does not support, so parameter types cannot be read.

      Wrap a token in Optional to let the argument receive undefined when the token has no provider.

      Parameters

      • ...tokens: readonly InjectToken[]

        One entry per constructor argument, in argument order

      Returns SetuClassDecorator

      A class decorator

      @Injectable()
      @Inject(CAPABILITIES.DATABASE, Optional(CAPABILITIES.CACHE))
      class UserRepository {
      constructor(private db: Db, private cache?: ICacheService) {}
      }

      0.1.0