Title: TypedDict update() does not accept TypedDict with compatible subset keys · Issue #6462 · python/mypy · GitHub
Open Graph Title: TypedDict update() does not accept TypedDict with compatible subset keys · Issue #6462 · python/mypy
X Title: TypedDict update() does not accept TypedDict with compatible subset keys · Issue #6462 · python/mypy
Description: from mypy_extensions import TypedDict A = TypedDict( 'A', { 'foo': int, 'bar': int, } ) B = TypedDict( 'B', { 'foo': int, } ) a = A({'foo': 1, 'bar': 2}) b = B({'foo': 2}) a.update({'foo': 2}) a.update(b) Expect this to pass type checkin...
Open Graph Description: from mypy_extensions import TypedDict A = TypedDict( 'A', { 'foo': int, 'bar': int, } ) B = TypedDict( 'B', { 'foo': int, } ) a = A({'foo': 1, 'bar': 2}) b = B({'foo': 2}) a.update({'foo': 2}) a.up...
X Description: from mypy_extensions import TypedDict A = TypedDict( 'A', { 'foo': int, 'bar': int, } ) B = TypedDict( 'B', { 'foo': int, } ) a = A({'foo': 1, 'b...
Opengraph URL: https://github.com/python/mypy/issues/6462
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypedDict update() does not accept TypedDict with compatible subset keys","articleBody":"```\r\nfrom mypy_extensions import TypedDict\r\n\r\nA = TypedDict(\r\n 'A', {\r\n 'foo': int,\r\n 'bar': int,\r\n }\r\n)\r\n\r\nB = TypedDict(\r\n 'B', {\r\n 'foo': int,\r\n }\r\n)\r\n\r\na = A({'foo': 1, 'bar': 2})\r\nb = B({'foo': 2})\r\na.update({'foo': 2})\r\na.update(b)\r\n```\r\n\r\nExpect this to pass type checking but got this error:\r\n```\r\ntest.py:19: error: Argument 1 to \"update\" of \"TypedDict\" has incompatible type \"B\"; expected \"TypedDict({'foo'?: int, 'bar'?: int})\"\r\n```\r\n","author":{"url":"https://github.com/yuyangguo42","@type":"Person","name":"yuyangguo42"},"datePublished":"2019-02-21T21:51:33Z","url":"https://github.com/python/mypy/issues/6462"}
| 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:63a48a59-5b67-a913-2c79-41038a230804 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5CE:A2351:5C747:81686:6B005073 |
| html-safe-nonce | 05321076af384bc2666a76f4ec740e98aebd21cf1bfa04c2d76c90e4353f1799 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUNFOkEyMzUxOjVDNzQ3OjgxNjg2OjZCMDA1MDczIiwidmlzaXRvcl9pZCI6Ijc5MzE5NDkyMzMyOTUzNDc4MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0e4bb0336682f902073536f6bb2ed7127030b6c638adbede51e6c3cf8aa431e5 |
| hovercard-subject-tag | issue:413140219 |
| 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/6462/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca820b18bf3e9a2bd10b3cd224152c94746ed66c62c33209c4ba73dd0aeb12a5/python/mypy/issues/6462 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca820b18bf3e9a2bd10b3cd224152c94746ed66c62c33209c4ba73dd0aeb12a5/python/mypy/issues/6462 |
| og:image:alt | from mypy_extensions import TypedDict A = TypedDict( 'A', { 'foo': int, 'bar': int, } ) B = TypedDict( 'B', { 'foo': int, } ) a = A({'foo': 1, 'bar': 2}) b = B({'foo': 2}) a.update({'foo': 2}) a.up... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yuyangguo42 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width