Skip to content

The yield type of a (async) generator should be the inner type, not the iterator type #75

@llucax

Description

@llucax

Describe the bug
When writing generators, the yield type includes the Iterator type.

To Reproduce
Example file:

from typing import Iterator


def a_generator() -> Iterator[int]:
    """Generate a number.

    Yields:
        A number.
    """
    yield 1

Expected behavior
The yield type should be the inner type, for example for Iterator[int] it should be int.

Screenshots
In this case the yielded type is actually int, not Iterator[int].

image

System (please complete the following information):

  • mkdocstrings-python version: 1.1.2
  • Python version: e.g. 3.11
  • OS: Linux (Debian testing)

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