docs: add additional type generics to useAsyncData (#22760)

This commit is contained in:
Jabin 2023-08-23 19:09:52 +08:00 committed by GitHub
parent 16a200a65a
commit e058a10525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,15 +12,15 @@ Within your pages, components, and plugins you can use useAsyncData to get acces
## Type
```ts [Signature]
function useAsyncData(
function useAsyncData<DataT, DataE>(
handler: (nuxtApp?: NuxtApp) => Promise<DataT>,
options?: AsyncDataOptions<DataT>
): AsyncData<DataT>
function useAsyncData(
): AsyncData<DataT, DataE>
function useAsyncData<DataT, DataE>(
key: string,
handler: (nuxtApp?: NuxtApp) => Promise<DataT>,
options?: AsyncDataOptions<DataT>
): Promise<AsyncData<DataT>>
): Promise<AsyncData<DataT, DataE>
type AsyncDataOptions<DataT> = {
server?: boolean