python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.26k stars 2.79k forks source link

(😳) no error when instanciating `dict` type alias with invalid type #13320

Open DetachHead opened 2 years ago

DetachHead commented 2 years ago
from typing import TypeAlias

Values: TypeAlias = dict[str, int]

a = Values(foo="")  # no error

playground

KotlinIsland commented 2 years ago

No emoji in the title; didn't read

Seems to only affect dicts kwarg constructor. I can't repro with any other type.

KotlinIsland commented 2 years ago

It seems to only affect dict: playground