feat: export `UseContextReturn`
See original GitHub issue🆒 Your use case Add a description of your use case, and how this feature would help you.
I was trying to get the cookie-universal-nuxt module work in my project. I need to get $cookies from the context returned by useContext. However it $cookies doesn’t exist in UseContextReturn and there’s no way for me to extend it since it’s not exported.
🆕 The solution you’d like Can you please export this type?
🔍 Alternatives you’ve considered By the way, I ended up using this workaround, which seems to be a bit ugly:
const {
$axios,
$cookies,
}: {
$axios: NuxtAxiosInstance
$cookies: NuxtCookies
} = useContext() as any
ℹ️ Additional info No
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
docs: How do I extend UseContextReturn to account for other ...
I'm currently using @nuxtjs/auth-next among other plugins that all inject into the context. However, when accessing these properties with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dzcpy Looking at the type declaration, you will need to access it from app - so:
In other cases though, you shouldn’t augment UseContextReturn - just augment Nuxt types in the normal way and it will pick it up - see docs.
Thanks, it worked for me.