Skip to content

Commit

Permalink
fix(create-injection-token): type
Browse files Browse the repository at this point in the history
  • Loading branch information
ctran authored and ctran committed Jun 18, 2024
1 parent 94467ae commit 792bff1
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ function createProvideFn<
factory: (...args: any[]) => TValue,
opts: CreateProvideFnOptions<TFactory, TFactoryDeps> = {},
) {
const { deps = [], multi = false, extraProviders = [] } = opts;
const {
deps = [],
multi = false,
extraProviders = [],
isFunctionValue: isFunctionValueFromOpts = false,
} = opts;
return (
value?: TValue | (() => TValue),
isFunctionValue = opts.isFunctionValue ?? false,
isFunctionValue = isFunctionValueFromOpts,
) => {
let provider: Provider;
if (typeof value !== 'undefined') {
Expand Down Expand Up @@ -253,10 +258,9 @@ export function createNoopInjectionToken<
TOptions = Pick<
CreateInjectionTokenOptions<() => void, []>,
'extraProviders'
> &
(TMulti extends true ? { multi: true } : Record<string, never>) & {
isFunctionValue?: boolean;
},
> & { isFunctionValue?: boolean } & (TMulti extends true
? { multi: true }
: Record<string, never>),
>(description: string, options?: TOptions) {
type TReturn = TMulti extends true ? Array<TValue> : TValue;

Expand Down

0 comments on commit 792bff1

Please sign in to comment.