This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
NewType does not subclass correctly #254
Closed
Description
Summary
Types created by NewType
do not inherit any methods from their parents
To Reproduce
from typing import NewType
Foo = NewType("Foo", dict)
foo: Foo = Foo({})
foo.
Expected Output
Actual Output
More Info
The documentation for NewType states
The static type checker will treat the new type as if it were a subclass of the original type.
which is how Mypy behaves, but the language server treats NewType
types as ...well, new types.
I noticed this because TypedDict doesn't work either, and while writing that issue I discovered this.