Skip to content

Commit 82a4b30

Browse files
authored
feat!: return Provider[] from provider factories (#287)
# Refactors - Use `Provider[]` return type for provider factories to keep more options open in the future. BREAKING CHANGE: - `provideLocalRouterStore` returns `Provider[]` instead of `Provider` - `provideGlobalRouterStore` returns `Provider[]` instead of `Provider` No changes required in `providers` arrays, for example the following usage remains the same: ```typescript @component({ // (...) providers: [provideLocalRouterStore()], }) // (...) ```
1 parent 75f57f0 commit 82a4b30

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/router-component-store/src/lib/global-router-store/provide-global-router-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import { GlobalRouterStore } from './global-router-store';
3232
* })
3333
* export class AppModule {}
3434
*/
35-
export function provideGlobalRouterStore(): Provider {
35+
export function provideGlobalRouterStore(): Provider[] {
3636
const globalRouterStoreProvider: ClassProvider = {
3737
provide: RouterStore,
3838
useClass: GlobalRouterStore,
3939
};
4040

41-
return globalRouterStoreProvider;
41+
return [globalRouterStoreProvider];
4242
}

packages/router-component-store/src/lib/local-router-store/provide-local-router-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ import { LocalRouterStore } from './local-router-store';
3131
* heroId$: Observable<string | undefined> = this.#routerStore.selectQueryParam('id');
3232
* }
3333
*/
34-
export function provideLocalRouterStore(): Provider {
34+
export function provideLocalRouterStore(): Provider[] {
3535
const localRouterStoreProvider: ClassProvider = {
3636
provide: RouterStore,
3737
useClass: LocalRouterStore,
3838
};
3939

40-
return localRouterStoreProvider;
40+
return [localRouterStoreProvider];
4141
}

0 commit comments

Comments
 (0)