Skip to content

Setting () to Union, which means no type arguments doesn't get error #11261

@hyperkai

Description

@hyperkai

*Memo:

  • pyright test.py
  • pyright 1.1.408
  • Python 3.14.0

The error message caused by Union with one type says as shown below:

from typing import Union

v: Union[int] # Error

error: Union requires two or more type arguments (reportInvalidTypeArguments

But setting () to Union, which means no type arguments doesn't get error as shown below:

from typing import Union

v: Union[()] # No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions