-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types(runtime-core): Allow InjectionKey to be used as a valid PropertyKey #5089
Conversation
This would technically be a (type) breaking change though, it would break existing apps using This probably needs to be put in a minor release (where we by convention may ship type breaking changes) |
Yes |
Just want to point out that this problem also (as of my knowledge) is at hand when using the function Edit: For my tests I can use |
# Conflicts: # packages/runtime-core/src/apiInject.ts # test-dts/inject.test-d.ts
Size ReportBundles
Usages
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Looks like the constraint of not being able to use |
This allows the InjectionKey to be used as a PropertyKey, useful for the OptionsAPI.
This also affects VTU, since the user needs to provide it's own overrides if needed:
There's a small issue that this change brings, with this change a
Symbol
cannot be inferred as anInjectionKey
This should lay down some work to support typed injections on the
defineComponent
when using Options APIRef: microsoft/TypeScript#46956
Providing validation on
provide
ondefineComponent
is harder than expected because when do akeyof
it will convertInjectionKey
type into asymbol
losing the types.Here's typescript example
playground