Skip to content

type safety for provided? #731

Closed
Closed
@philipbjorge

Description

@philipbjorge

When referencing a singleton via foo.provided.bar, we lose type safety because provided always resolves to the ProvidedInstance rather than the specific type of the dependency.

    settings = providers.Singleton(Settings)
    
    identity_container = providers.Container(
        IdentityContainer,
        base_url=settings.provided.IDENTITY_SERVICE_BASE_URL,
    )

Expected
settings.provided resolves to Settings

Actual
settings.provided resolves to ProvidedInstance

This seems like an easy change to make -- Is there any reason this wouldn't work if I opened a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions