Commit a8b5368
committed
fix(vue-query): parameterize suspense return type by TResult
The previous shape pinned `suspense` to `Promise<QueryObserverResult<TData,
TError>>` inside the distributive conditional, so awaiting `suspense()` lost
type precision when `UseBaseQueryReturnType` was instantiated with
`DefinedQueryObserverResult` (data became `TData | undefined` again) or
`InfiniteQueryObserverResult` (no `fetchNextPage`/`hasNextPage`/`data.pages`).
Lifting `suspense` outside the distributive arm and typing it as
`Promise<TResult>` keeps the per-property mapping distributive but lets the
suspense result carry the parameterized observer type — matching the runtime
already returned by `observer.fetchOptimistic()` / `getOptimisticResult()`.1 parent 7375ffb commit a8b5368
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | 46 | | |
49 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments