Skip to content

Query return types #99

Open

Description

@danielknell

Description

The return type of a query is currently defined as Any, this prevents type-checking, and
also limits auto-completion in IDEs.

Motivation

By being able to specify the return type for a query for type checkers, we can enable static analysis on code using the query method, this is currently not possible without manually casting the return values on each use.

Possible implementation

Some kind of generic type.

class FooResult:
    bar: str

class FooQuery(Query[FooResult]):
    baz: str

this would have to be optional in able to continue supporting pure domain packages with no dependency on banshee.

Activity

  1. changed the title [-]feat: typed query return types[/-] [+]Query Return Types[/+] on Apr 4, 2025
  2. changed the title [-]Query Return Types[/-] [+]Query return types[/+] on Apr 4, 2025
  3. self-assigned this
    on Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions