Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt3): improve error types for useAsyncData and useFetch - #4210

Merged
pi0 merged 17 commits into
nuxt:mainfrom
Mini-ghost:feat/fetch-error-type
Apr 29, 2022
Merged

fix(nuxt3): improve error types for useAsyncData and useFetch #4210
pi0 merged 17 commits into
nuxt:mainfrom
Mini-ghost:feat/fetch-error-type

Conversation

@Mini-ghost

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 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)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Let useFetch() and useLazyFetch() return error can defined type by generics, like below:

const { data, error } = useFetch<TData, TError>('url')

📝 Checklist

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

@netlify

netlify Bot commented Apr 8, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs ready!

Name Link
🔨 Latest commit 20d9556
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/626c30bd4ff998000828e02e
😎 Deploy Preview https://deploy-preview-4210--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@pi0
pi0 requested a review from danielroe April 8, 2022 20:18
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
@Mini-ghost
Mini-ghost requested a review from danielroe April 8, 2022 22:40
@Mini-ghost

Copy link
Copy Markdown
Member Author

@danielroe I adjusted the generics naming, but I'm not sure why the test the CI / test-fixtures (windows-latest, 16) is wrong

Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
@Mini-ghost
Mini-ghost requested a review from pi0 April 12, 2022 08:57
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
Comment thread packages/nuxt3/src/app/composables/fetch.ts Outdated
@Mini-ghost
Mini-ghost requested a review from danielroe April 15, 2022 11:48
@pi0

pi0 commented Apr 22, 2022

Copy link
Copy Markdown
Member

@danielroe Can you please check this PR for refactors?

@danielroe danielroe self-assigned this Apr 25, 2022
@pi0 pi0 changed the title feat(nuxt3): let useFetch() return error can defined type by generics fix(nuxt3): improve error types for useAsyncData and useFetch Apr 29, 2022
@pi0

pi0 commented Apr 29, 2022

Copy link
Copy Markdown
Member

Thanks @Mini-ghost @danielroe 💚

@pi0
pi0 merged commit eb903bd into nuxt:main Apr 29, 2022
@pi0 pi0 mentioned this pull request May 2, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants