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

fix(nuxt3)!: custom response type for useFetch using first generic #3268

Merged
merged 2 commits into from
Feb 16, 2022

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Feb 16, 2022

πŸ”— Linked issue

Resolves nuxt/nuxt#13386

❓ 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

Allow setting custom response type of useFetch using first generic param similar to $fetch

Breaking change! If you was already using useFetch or useLazyFetch with custom type, it needs to be updated:

--- useFetch<string, ResponseType>(....)
+++ useFetch<ResponseType>(....)

πŸ“ Checklist

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

@pi0 pi0 requested a review from danielroe February 16, 2022 20:10
@netlify
Copy link

netlify bot commented Feb 16, 2022

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: 4c92fa8

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/620d6370d6123b0008e0f108

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An elegant solution πŸ‘Œ

test/fixtures/basic/tests/types.ts Show resolved Hide resolved
@pi0 pi0 merged commit 77aeaa3 into main Feb 16, 2022
@pi0 pi0 deleted the fix/use-fetch-type branch February 16, 2022 20:50
@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.

useFetch type return
2 participants