Separate typings for provide | Typescript
What problem does this feature solve?
Currently Provide/Inject uses only one key generic to both key and value - provide<T> = (key: InjectionKey<T>, value: T)
My request is to make app.provide<K,T> = (key: InjectionKey<K>, value: T)
so that key and value have their own type respectively.
What does the proposed API look like?
What would be K
, if not the value you provide - which in your API is T
?
I don't understand what the goal of this change would be.
In my case I wanted K would be string
and value T would be Function
type. Currently, when I inject the function it doesn't provide typings and show errors that the injected object is type of {}
, but I wanted it to be Function
InjectionKey<Function>
would give you an injection whose value is Function
.
I dont see what problem your proposal is meant to solve.