8000 "Invalid type" error when creating a synonym for Optional[int] · Issue #1637 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
"Invalid type" error when creating a synonym for Optional[int] #1637
Closed
@rwbarton

Description

@rwbarton
from typing import Optional
MyType = Optional[int]
def f(x: bool) -> MyType:
    pass

produces an error

x/invalidtype.py: note: In function "f":
x/invalidtype.py:4: error: Invalid type "invalidtype.MyType"

A type synonym for Union[str, int] works fine.

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

      0