From c6de29e7b64a59b107dd62decffb641f79abc5eb Mon Sep 17 00:00:00 2001 From: Peter Lauck Date: Fri, 29 Dec 2023 14:23:14 +0000 Subject: [PATCH] provider generics --- libs/core/src/injection-tokens/config.factory.ts | 2 +- libs/core/src/injection-tokens/config.type.ts | 2 +- libs/core/src/injection-tokens/multi.factory.ts | 2 +- libs/core/src/injection-tokens/multi.type.ts | 2 +- libs/core/src/injection-tokens/services.factory.ts | 2 +- libs/core/src/injection-tokens/services.type.ts | 2 +- libs/core/src/injection-tokens/single.factory.ts | 2 +- libs/core/src/injection-tokens/single.type.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/core/src/injection-tokens/config.factory.ts b/libs/core/src/injection-tokens/config.factory.ts index 5d28a8de8c..6cb8df127a 100644 --- a/libs/core/src/injection-tokens/config.factory.ts +++ b/libs/core/src/injection-tokens/config.factory.ts @@ -23,7 +23,7 @@ export const createConfigInjectionToken = ( ...options, }, ); - const provider = (config: Partial) => ({ + const provider = (config: Partial) => ({ provide: token, useValue: { ...defaultConfig, diff --git a/libs/core/src/injection-tokens/config.type.ts b/libs/core/src/injection-tokens/config.type.ts index 0565f71077..350f88bc46 100644 --- a/libs/core/src/injection-tokens/config.type.ts +++ b/libs/core/src/injection-tokens/config.type.ts @@ -18,5 +18,5 @@ export interface DaffConfigInjectionToken { * It will shallow merge the passed config with the default config * with the passed config keys taking precedence. */ - provider: (config: Partial) => ValueProvider; + provider: (config: Partial) => ValueProvider; } diff --git a/libs/core/src/injection-tokens/multi.factory.ts b/libs/core/src/injection-tokens/multi.factory.ts index e3ba3b6eac..79c90c99dc 100644 --- a/libs/core/src/injection-tokens/multi.factory.ts +++ b/libs/core/src/injection-tokens/multi.factory.ts @@ -26,7 +26,7 @@ export const createMultiInjectionToken = ( ...options, }, ); - const provider = (...values: Array) => values.map((value) => ({ + const provider = (...values: Array) => values.map((value) => ({ provide: token, useValue: value, multi: true, diff --git a/libs/core/src/injection-tokens/multi.type.ts b/libs/core/src/injection-tokens/multi.type.ts index f23615d691..1d4e3f8ad8 100644 --- a/libs/core/src/injection-tokens/multi.type.ts +++ b/libs/core/src/injection-tokens/multi.type.ts @@ -16,5 +16,5 @@ export interface DaffMultiInjectionToken { /** * A helper function to provide values to the token. */ - provider: (...values: Array) => Array; + provider: (...values: Array) => Array; } diff --git a/libs/core/src/injection-tokens/services.factory.ts b/libs/core/src/injection-tokens/services.factory.ts index b4de0c89cc..40aeaaeaea 100644 --- a/libs/core/src/injection-tokens/services.factory.ts +++ b/libs/core/src/injection-tokens/services.factory.ts @@ -29,7 +29,7 @@ export const createServicesInjectionToken = ( ...options, }, ); - const provider = (...classes: Array>) => classes.map((klass) => ({ + const provider = (...classes: Array>) => classes.map((klass) => ({ provide: token, useExisting: klass, multi: true, diff --git a/libs/core/src/injection-tokens/services.type.ts b/libs/core/src/injection-tokens/services.type.ts index 489089d583..de428866b9 100644 --- a/libs/core/src/injection-tokens/services.type.ts +++ b/libs/core/src/injection-tokens/services.type.ts @@ -17,5 +17,5 @@ export interface DaffServicesInjectionToken { /** * A helper function to provide service classes to the token. */ - provider: (...classes: Array>) => Array; + provider: (...classes: Array>) => Array; } diff --git a/libs/core/src/injection-tokens/single.factory.ts b/libs/core/src/injection-tokens/single.factory.ts index 508fc5dd21..dd950f9555 100644 --- a/libs/core/src/injection-tokens/single.factory.ts +++ b/libs/core/src/injection-tokens/single.factory.ts @@ -9,7 +9,7 @@ import { DaffSingleInjectionToken } from './single.type'; */ export const createSingleInjectionToken = (...args: ConstructorParameters>): DaffSingleInjectionToken => { const token = new InjectionToken(...args); - const provider = (value: T) => ({ + const provider = (value: R) => ({ provide: token, useValue: value, }); diff --git a/libs/core/src/injection-tokens/single.type.ts b/libs/core/src/injection-tokens/single.type.ts index 562f079b65..15f89d39cb 100644 --- a/libs/core/src/injection-tokens/single.type.ts +++ b/libs/core/src/injection-tokens/single.type.ts @@ -15,5 +15,5 @@ export interface DaffSingleInjectionToken { /** * A helper function to provide a value to the token. */ - provider: (value: T) => ValueProvider; + provider: (value: R) => ValueProvider; }