@tstdl/base 0.91.27 → 0.91.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,5 +4,13 @@ export type ValueOrProvider<T> = T extends (() => any) ? never : (T | Provider<T
|
|
|
4
4
|
export type ValueOrAsyncProvider<T> = T extends (() => any) ? never : (T | Provider<T> | AsyncProvider<T>);
|
|
5
5
|
export type ResolvedValueOrProvider<T extends ValueOrAsyncProvider<any>> = T extends ValueOrAsyncProvider<infer U> ? U : never;
|
|
6
6
|
export declare function resolveValueOrProvider<T>(valueOrProvider: ValueOrProvider<T>): T;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated use {@link resolveValueOrAsyncProvider}
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveAsyncValueOrProvider<T>(valueOrProvider: ValueOrAsyncProvider<T>): Promise<T>;
|
|
7
11
|
export declare function resolveValueOrAsyncProvider<T>(valueOrProvider: ValueOrAsyncProvider<T>): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use {@link cacheValueOrAsyncProvider}
|
|
14
|
+
*/
|
|
15
|
+
export declare function cacheAsyncValueOrProvider<T>(provider: ValueOrAsyncProvider<T>): () => (T | Promise<T>);
|
|
8
16
|
export declare function cacheValueOrAsyncProvider<T>(provider: ValueOrAsyncProvider<T>): () => (T | Promise<T>);
|
|
@@ -5,12 +5,24 @@ export function resolveValueOrProvider(valueOrProvider) {
|
|
|
5
5
|
}
|
|
6
6
|
return valueOrProvider;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use {@link resolveValueOrAsyncProvider}
|
|
10
|
+
*/
|
|
11
|
+
export async function resolveAsyncValueOrProvider(valueOrProvider) {
|
|
12
|
+
return resolveValueOrAsyncProvider(valueOrProvider);
|
|
13
|
+
}
|
|
8
14
|
export async function resolveValueOrAsyncProvider(valueOrProvider) {
|
|
9
15
|
if (isFunction(valueOrProvider)) {
|
|
10
16
|
return valueOrProvider();
|
|
11
17
|
}
|
|
12
18
|
return valueOrProvider;
|
|
13
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use {@link cacheValueOrAsyncProvider}
|
|
22
|
+
*/
|
|
23
|
+
export function cacheAsyncValueOrProvider(provider) {
|
|
24
|
+
return cacheValueOrAsyncProvider(provider);
|
|
25
|
+
}
|
|
14
26
|
export function cacheValueOrAsyncProvider(provider) {
|
|
15
27
|
let getValue = async () => {
|
|
16
28
|
const valuePromise = resolveValueOrAsyncProvider(provider);
|