-
Notifications
You must be signed in to change notification settings - Fork 1
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
withInjectable and Inject with optional providers. #8
Comments
I'm not completely sure I understand the issue here. can you provide codesandbox or at least some code snippet? thanks ! |
Hmm, so what you want is basically similar functionality like Angular ElementInjector provides right? To be able to mark injected providers on component level, so that means, covering:
|
Following api comes up in my mind: <Inject values={tuple(ServiceA, optional(ServiceB))} >{
/* $ExpectType [ServiceA, ServiceB | null ] */
(instA, instB)=> { ... }
}</Inject> WDYT?
|
Yep, that's it. Just what I needed. For the time being, I think that with just |
Feature request
Optional injection feature in "withInjectable" HoC and "Inject" component.
Use case(s)
I just want a way to do optional injection to a react component like using "Optional" decorators. I have an optional injectable service and I do not want the application to crash with the error: "No provider for X!"
The text was updated successfully, but these errors were encountered: