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

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

Merged
pi0 merged 3 commits into
nuxt:mainfrom
tobyfaux:fix/async-data-union-types
Nov 16, 2022
Merged

pi0 merged 3 commits into
nuxt:mainfrom
tobyfaux:fix/async-data-union-types

Conversation

@tobyfaux

Copy link
Copy Markdown
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

codesandbox Bot commented Nov 16, 2022

Copy link
Copy Markdown

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
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