Title: TypedDict.get returns an `object` if a dictionary has more than one field and the types on those fields differ. · Issue #2612 · python/mypy · GitHub
Open Graph Title: TypedDict.get returns an `object` if a dictionary has more than one field and the types on those fields differ. · Issue #2612 · python/mypy
X Title: TypedDict.get returns an `object` if a dictionary has more than one field and the types on those fields differ. · Issue #2612 · python/mypy
Description: This appears to be due to TypedDict relying on a fallback. from typing import List, Optional from mypy_extensions import TypedDict TaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y': int}) Point3D = TypedDict('Point3D', {...
Open Graph Description: This appears to be due to TypedDict relying on a fallback. from typing import List, Optional from mypy_extensions import TypedDict TaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y'...
X Description: This appears to be due to TypedDict relying on a fallback. from typing import List, Optional from mypy_extensions import TypedDict TaggedPoint = TypedDict('TaggedPoint', {'type': st...
Opengraph URL: https://github.com/python/mypy/issues/2612
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypedDict.get returns an `object` if a dictionary has more than one field and the types on those fields differ.","articleBody":"This appears to be due to TypedDict relying on a fallback.\r\n\r\n```python\r\nfrom typing import List, Optional\r\nfrom mypy_extensions import TypedDict\r\n\r\nTaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y': int})\r\nPoint3D = TypedDict('Point3D', {'x': int, 'y': int, 'z': int})\r\nBadPointSet = TypedDict('BadPointSet', {\r\n 'total_length': int,\r\n 'points': List[TaggedPoint]\r\n})\r\nOKPointSet = TypedDict('OKPointSet', {\r\n 'points': List[TaggedPoint]\r\n})\r\n\r\ndef foo(point_3d: Point3D,\r\n tagged_point: TaggedPoint,\r\n bad_points: BadPointSet,\r\n ok_points: OKPointSet) -> None:\r\n reveal_type(point_3d.get('x')) # error: Revealed type is 'builtins.int*\r\n reveal_type(tagged_point.get('x')) # error: Revealed type is 'builtins.object*\r\n reveal_type(bad_points.get('points')) # error: Revealed type is 'builtins.object*'\r\n reveal_type(ok_points.get('points')) # Revealed type is 'builtins.list*[TypedDict(x=builtins.int, y=builtins.int, _fallback=test_typed_dict_get.TaggedPoint)]'\r\n```","author":{"url":"https://github.com/rowillia","@type":"Person","name":"rowillia"},"datePublished":"2016-12-27T22:03:22Z","url":"https://github.com/python/mypy/issues/2612"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:19036df3-402e-2aa3-f2dd-421a723e1bf2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E292:3DAD59:21844B5:2C6897E:6B0049BB |
| html-safe-nonce | aafceaa51515e75efed595d13e5bf125be15063dc19bd2d81aaff466a380b8e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjkyOjNEQUQ1OToyMTg0NEI1OjJDNjg5N0U6NkIwMDQ5QkIiLCJ2aXNpdG9yX2lkIjoiODQwMDIxMjc1MDAyNTkwMjUyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d8a8f1a9ae2bc8189fd9e32df4a9ef3b320373eb9ae7e1ed19e361f7aed19d16 |
| hovercard-subject-tag | issue:197763779 |
| 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/python/mypy/2612/issue_layout |
| twitter:image | https://opengraph.githubassets.com/31e392fb8e457aa72f88901e20988a9053bb2a2c6f53c94b2bbfec7790ef0f96/python/mypy/issues/2612 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/31e392fb8e457aa72f88901e20988a9053bb2a2c6f53c94b2bbfec7790ef0f96/python/mypy/issues/2612 |
| og:image:alt | This appears to be due to TypedDict relying on a fallback. from typing import List, Optional from mypy_extensions import TypedDict TaggedPoint = TypedDict('TaggedPoint', {'type': str, 'x': int, 'y'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rowillia |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width