Skip to main content

v2.xv3.x

Root registration method renamed

  • The root registration method was renamed from register (resp. registerAsync) to forRoot (resp. forRootAsync) to align with the convention.
- ClsModule.register({
+ ClsModule.forRoot({
middleware: { mount: true },
}),

Namespace support dropped

Namespace injection support with forFeature was dropped entirely, and now that method is used to register Proxy Providers. If you still have a use case for namespaces, you can create a namespaced ClsService and use a custom provider to inject it.
Example:

class MyContextService extends ClsService<MyStore> {}
const myContextService = new MyContextService(new AsyncLocalStorage());

// [...]
providers: [
{
provide: MyContextService,
useValue: myContextService,
},
];