Skip to content

Unexpected type checking with pyright #94

Description

@DanielSank

Using pyright in neovim, I see unexpected behavior in type checking:

import tunits as tu

x = (tu.ElectricPotentialArray(np.array([1, 2, 3]) * tu.V), 5 * tu.W)
reveal_type(x)  # Type of "x" is "tuple[ElectricPotentialArray, Power]"
y = x[tu.V]
reveal_type(y)  # Type of "y" is "ElectricPotentialArray | Power"

The third line should be flagged as a type error. From the fourth line, it looks like tu.V is being treated as an integer. Is it possible that the type annotations for this library have some bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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