Skip to content

[Bug]: error: Value of type variable "LT" of "min" cannot be "Coroutine[Any, Any, Decimal]"Β #185

@d3cryptofc

Description

@d3cryptofc

What happened?

Mypy displays this error when I pass an async function in the key parameter of asyncstdlib.min.

$ mypy file.py --strict
file.py:X: error: Value of type variable "LT" of "min" cannot be "Coroutine[Any, Any, int]"  [type-var]

Minimal Reproducible Example

import asyncio
import asyncstdlib as a

async def my_custom_getter(item: int) -> int:
    # awaits here
    return item

async def example():
    await a.min([1, 2, 3], key=my_custom_getter)

asyncio.run(example())

Request Assignment [Optional]

  • I already understand the cause and want to submit a bugfix.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions