Documents injecute 1.x · Migrating from 0.x
Skip to content

Interface: Namespace ​

Defined in: src/types.ts:423

Stands for a namespace in a service map. The map keeps each service of a namespace once, under Name.key; get('Name') returns a ServiceProvider of those services (see ServiceType). Keeping the provider out of the map keeps inferred types and emitted .d.ts files small.

Example ​

ts
const app = new DIContainer().namespace('Billing', (b) => b.addInstance('currency', 'EUR'));

type Services = ContainerServices<typeof app>; // { Billing: Namespace; 'Billing.currency': string }
app.get('Billing'); // ServiceProvider<{ currency: string }>

Properties ​

[namespaceBrand] ​

readonly [namespaceBrand]: "sync"

Defined in: src/types.ts:424

Released under the MIT License.