You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @OptionalInject wrapper only works if one provides a non-optional component. If the component is optional, the @OptionalInject wrapped instance always ends up nil.
This appears to be because the component is registered using its optional type (e.g. Optional<ComponentF>) but then the resolve fails as it is looking for non-optional type (e.g. ComponentF).
This can be demonstrated in DIKitTests testOptionalInjection by making ComponentF's init optional.
Doing this causes the test to fail.
The text was updated successfully, but these errors were encountered:
The @OptionalInject wrapper only works if one provides a non-optional component. If the component is optional, the @OptionalInject wrapped instance always ends up nil.
This appears to be because the component is registered using its optional type (e.g.
Optional<ComponentF>
) but then the resolve fails as it is looking for non-optional type (e.g.ComponentF
).This can be demonstrated in DIKitTests testOptionalInjection by making
ComponentF
's init optional.Doing this causes the test to fail.
The text was updated successfully, but these errors were encountered: