diff --git a/libs/ngxtension/create-injection-token/src/create-injection-token.ts b/libs/ngxtension/create-injection-token/src/create-injection-token.ts index 4be07a5c..5e79e8b1 100644 --- a/libs/ngxtension/create-injection-token/src/create-injection-token.ts +++ b/libs/ngxtension/create-injection-token/src/create-injection-token.ts @@ -54,7 +54,7 @@ type CreateProvideFnOptions< > = Pick< CreateInjectionTokenOptions, 'deps' | 'extraProviders' | 'multi' ->; +> & { isFunctionValue?: boolean }; type InjectFn = { (): TFactoryReturn; @@ -114,7 +114,10 @@ function createProvideFn< opts: CreateProvideFnOptions = {}, ) { const { deps = [], multi = false, extraProviders = [] } = opts; - return (value?: TValue | (() => TValue), isFunctionValue = false) => { + return ( + value?: TValue | (() => TValue), + isFunctionValue = opts.isFunctionValue ?? false, + ) => { let provider: Provider; if (typeof value !== 'undefined') { // TODO: (chau) maybe this can be made better @@ -251,7 +254,9 @@ export function createNoopInjectionToken< CreateInjectionTokenOptions<() => void, []>, 'extraProviders' > & - (TMulti extends true ? { multi: true } : Record), + (TMulti extends true ? { multi: true } : Record) & { + isFunctionValue?: boolean; + }, >(description: string, options?: TOptions) { type TReturn = TMulti extends true ? Array : TValue;