requireRepository
function requireRepository<T>(
repository: T | null | undefined,
message: string = "Repository is not defined."
): T;
requireService for the layer above the services: a data source that a container was supposed to provide and did not. The exception names the situation instead of leaving a null to travel further.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The repository to check. |
|
| The message of the exception. A default is used when omitted. |
Returns
T — the same repository.
Throws
Exception | Condition |
|---|---|
| the repository is |
Examples
In use
const users = requireRepository(registry.users, "The user repository is not wired up.");
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.