FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

NewType does not subclass correctly · Issue #254 · microsoft/python-language-server · GitHub

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

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL