File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,18 @@ type AsyncDataResult<T> = AsyncData<T, Error>;
10
10
/**
11
11
* Transforms an object's Promise-returning functions into functions compatible with useAsyncData.
12
12
*
13
+ * Only includes functions that return Promises; other properties are excluded.
14
+ *
13
15
* For each function in the object:
14
16
* - If the function returns a Promise and takes no arguments, it becomes a function that accepts optional AsyncDataOptions.
15
17
* - If the function returns a Promise and takes arguments, it becomes a function that accepts an argsSupplier and optional AsyncDataOptions.
16
18
*
17
- * This allows you to use the functions within a Nuxt application, leveraging the reactivity and data fetching capabilities of useAsyncData.
18
- *
19
19
* @template T - The type of the object.
20
20
*/
21
21
export type AsyncDataWrapper < T > = {
22
- [ K in keyof T ] : T [ K ] extends ( ...args : infer Args ) => Promise < infer R >
22
+ [ K in keyof T as T [ K ] extends ( ...args : any [ ] ) => Promise < any >
23
+ ? K
24
+ : never ] : T [ K ] extends ( ...args : infer Args ) => Promise < infer R >
23
25
? Args extends [ ]
24
26
? /**
25
27
* Functions without arguments.
You can’t perform that action at this time.
0 commit comments