Function: collect()
collect<
T>(tag):CollectDependency<T>
Defined in: src/dependencies.ts:109
A dependency on every service registered under a tag: every key that ends with :<tag>, also in namespaces (Orders.orders:route), in registration order. The services are collected in the container that creates the dependent service, so an isolated fork's replacements and additions are included. An AsyncDIContainer awaits each of them.
Type Parameters
T
T
Parameters
tag
Tag<T, string>
Returns
Throws
INJECUTE_INVALID_DEPENDENCY when tag is not a tag made by createTag().
Example
ts
const command = createTag('command').of<Command>();
app
.addSingleton(command('migrate'), MigrateCommand, ['db'])
.addSingleton(command('seed'), SeedCommand, ['db'])
.addSingleton('cli', (commands) => new Cli(commands), [collect(command)]); // Command[]