Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: sync useAsyncData and useFetch types #20935

Merged
merged 1 commit into from May 18, 2023

Conversation

jongmin4943
Copy link
Contributor

@jongmin4943 jongmin4943 commented May 18, 2023

Synchronize type AsyncData with asyncData.d.ts

πŸ”— Linked issue

none

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I opened discussion #20885. It was questions of data-fetching.
I decided to dig into that so I checked the codes and found that in useFetch and useAsyncData docs, type definition is different from asyncData.d.ts. type AsyncData in useFetch docs is even wrong.

type AsyncData<DataT> = {  // where is Error generic?
  data: Ref<DataT>
  pending: Ref<boolean>
  refresh: (opts?: { dedupe?: boolean }) => Promise<void>
  execute: () => Promise<void>
  error: Ref<Error | boolean>
}

There is a property in AsyncDataExecuteOptions which is _initial but I didn't added it since I couldn't find anything relative that in Nuxt docs.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Synchronize `type AsyncData` with `asyncData.d.ts`
@nuxt-studio
Copy link

nuxt-studio bot commented May 18, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview d912389

@danielroe danielroe changed the title docs: fix useAsyncData, useFetch type docs: sync useAsyncData and useFetch types May 18, 2023
@danielroe danielroe merged commit da29ac0 into nuxt:main May 18, 2023
1 check passed
This was referenced May 18, 2023
@jongmin4943 jongmin4943 deleted the docs-AsyncData-type branch May 29, 2023 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants