Function Module

  • Defines a Module given a list of:

    • Modules, which will be applied in the given order when applying the return module
    • Functions that take a Builder and provide resources and scopes
    • Arbitrarily-nested lists of the above

    Type Parameters

    Parameters

    • Rest ...m: M

    Returns Module<Provides<M>>

    Example

    Providing resources and scopes:

    const UserModule = Module(ct => ct
    .addScope(UserScope)
    .provideInstance(NameKey, 'Alice')
    .provideInstance(IdKey, 123)
    .provide(User, Inject.construct(User, NameKey, IdKey))
    )

    Example

    Combining Modules:

    const AppModule = Module(UserModule, DataModule, FooModule)
    

Generated using TypeDoc