Skip to content
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
@Lexicality

Description

@Lexicality

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

image

Actual Output

image

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions