Skip to content

Typing bug in FeatureManager.is_enabled overloads: single argument call not supported by type hints #62

@taylorn-ai

Description

@taylorn-ai
  • Package Version: 2.1.0
  • Operating System: Ubuntu
  • Python Version: 3.12

Describe the bug
The FeatureManager.is_enabled method has incorrect type hints in the published SDK.

The implementation accepts a single argument:

await feature_manager.is_enabled("my-flag")

This works at runtime because the method signature is:

async def is_enabled(self, feature_flag_id: str, *args, **kwargs) -> bool

However, the declared overloads do not include a signature that accepts only one argument. The only available overload is:

@overload
async def is_enabled(self, feature_flag_id: str, user_id: str, **kwargs) -> bool:
    ...

Type checkers such as Mypy report this usage as invalid and treat the return type as Any.

Expected Behavior
The type hints should describe all valid usages. Since the runtime implementation allows calling the method with only feature_flag_id, the overloads should include a matching variant.

Proposed Fix
Add a second overload:

@overload
async def is_enabled(self, feature_flag_id: str) -> bool:
    ...

This aligns the type hints with the implementation and returns the correct bool type to static analysis tools.

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