Skip to content

Typing #189

@bobthemighty

Description

@bobthemighty

In the years since I wrote this lib, as a proof of concept, people have

A) started using it in earnest, much to my surprise
B) adopted type hints as a best practice for Python development

It would be nice if the container supported typing, at least for registration, so that

container.register(SomeService, SomeImpl)
container.resolve(SomeService)

is known to return SomeService. The challenge here is that the key for the container isn't restricted in any way, so this is likely a breaking change, unless we can get fancy with Pyright so that resolve[TService](k: Type[TService]) -> TService while resolve(k: any) -> any.

The situation for registrations is likely to be harder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions