Is there type safety for inject and provide with the options API? #11297
dyllandry
started this conversation in
General Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am migrating a vue 3 options API code base to using typescript. There are some components using provide & inject. I'd like to provide type safety for that using the options API.
I noticed some issues asking about inject and provide type safety with the options api:
inject
option in Mixins cant be inferred #7751ComponentPublicInstance
in TypeScript #5931This PR made injected properties all resolve to
unknown
and closed some of the issues asking for support: #6804Is there a way to actually receive the correct type when using the options API? I know you can do it with the composition API using
InjectionKey
.I've tried the following but get an error:
Beta Was this translation helpful? Give feedback.
All reactions