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

fix(nuxt): allow union type arguments for useAsyncData #9061

Merged
merged 3 commits into from Nov 16, 2022

Conversation

tobyfaux
Copy link
Contributor

πŸ”— Linked issue

Resolves nuxt/nuxt#14698.

❓ 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

Resolves nuxt/nuxt#14698 by updating the KeysOf type so that a union type argument yields all keys of all types in the union. This ensures that calling useAsyncData with a union type argument will result in the returned data value having the same union type instead of a type consisting of only the members that are common to all types in the union.

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Nov 16, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@pi0 pi0 requested a review from danielroe November 16, 2022 13:55
@pi0 pi0 merged commit 32044dc into nuxt:main Nov 16, 2022
@tobyfaux tobyfaux deleted the fix/async-data-union-types branch November 16, 2022 21:37
@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.

useAsyncData handles discriminated unions incorrectly
3 participants