Skip to content

False negatives for functional TypedDicts + postponed evaluations #10612

@brentyi

Description

@brentyi

Hello!

This script fails at runtime, but doesn't raise any type errors:

from __future__ import annotations
from typing import TypedDict

X = TypedDict("X", {"field": Integer})  # Fails at runtime, no type error.
Integer = int

It looks like Integer is treated as a stringified annotation. Is this expected behavior?

Pyright Playground reproduction

Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions