Title: NewType does not subclass correctly · Issue #254 · microsoft/python-language-server · GitHub
Open Graph Title: NewType does not subclass correctly · Issue #254 · microsoft/python-language-server
X Title: NewType does not subclass correctly · Issue #254 · microsoft/python-language-server
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 NewTy...
Open Graph 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 Outp...
X 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 A...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/254
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NewType does not subclass correctly","articleBody":"## Summary\r\nTypes created by `NewType` do not inherit any methods from their parents\r\n## To Reproduce\r\n```python\r\nfrom typing import NewType\r\n\r\nFoo = NewType(\"Foo\", dict)\r\n\r\nfoo: Foo = Foo({})\r\nfoo.\r\n```\r\n## Expected Output\r\n\r\n## Actual Output\r\n\r\n\r\n## More Info\r\n[The documentation for NewType](https://docs.python.org/3.6/library/typing.html#newtype) states\r\n\r\n\u003e The static type checker will treat the new type as if it were a subclass of the original type.\r\n\r\nwhich is how Mypy behaves, but the language server treats `NewType` types as ...well, new types.\r\nI noticed this because [TypedDict](https://mypy.readthedocs.io/en/latest/more_types.html#typeddict) doesn't work either, and while writing that issue I discovered this.","author":{"url":"https://github.com/Lexicality","@type":"Person","name":"Lexicality"},"datePublished":"2018-10-13T15:42:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/254/python-language-server/issues/254"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b7b7cb0c-8770-1e00-5789-a5e4ec71709c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBCE:13657F:140E321:1D3F994:6A4E434E |
| html-safe-nonce | 5cab8af6705e18e2e3d6a6bbaf14e9040932b2bdf93c5b771802916e210fadd7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkNFOjEzNjU3RjoxNDBFMzIxOjFEM0Y5OTQ6NkE0RTQzNEUiLCJ2aXNpdG9yX2lkIjoiNjM0Nzc4NjgzMDAzNzc5NTY2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2f61b6833fca72b3270c26d400da9a5f63c035f02a2a11d27ed8c92d121b2ab2 |
| hovercard-subject-tag | issue:369813694 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/python-language-server/254/issue_layout |
| twitter:image | https://opengraph.githubassets.com/172e76dcef1004c650a53579caf154d96e28cb835c1459871c8a99a411a3808d/microsoft/python-language-server/issues/254 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/172e76dcef1004c650a53579caf154d96e28cb835c1459871c8a99a411a3808d/microsoft/python-language-server/issues/254 |
| og:image:alt | 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 Outp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Lexicality |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9fabff9b8b127e686a3ec86f91422e818056ca2c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width