mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
docs: add additional type generics to useFetch
docs (#22755)
Co-authored-by: 李杰 <ajay.li@feisu.com>
This commit is contained in:
parent
a2f2a4748e
commit
60c1eec047
@ -10,12 +10,12 @@ It automatically generates a key based on URL and fetch options, provides type h
|
|||||||
## Type
|
## Type
|
||||||
|
|
||||||
```ts [Signature]
|
```ts [Signature]
|
||||||
function useFetch(
|
function useFetch<DataT, ErrorT>(
|
||||||
url: string | Request | Ref<string | Request> | () => string | Request,
|
url: string | Request | Ref<string | Request> | () => string | Request,
|
||||||
options?: UseFetchOptions<DataT>
|
options?: UseFetchOptions<DataT>
|
||||||
): Promise<AsyncData<DataT>>
|
): Promise<AsyncData<DataT, ErrorT>>
|
||||||
|
|
||||||
type UseFetchOptions = {
|
type UseFetchOptions<DataT> = {
|
||||||
key?: string
|
key?: string
|
||||||
method?: string
|
method?: string
|
||||||
query?: SearchParams
|
query?: SearchParams
|
||||||
|
Loading…
Reference in New Issue
Block a user