Title: In a union, types with index signatures should contribute types to all properties · Issue #21141 · microsoft/TypeScript · GitHub
Open Graph Title: In a union, types with index signatures should contribute types to all properties · Issue #21141 · microsoft/TypeScript
X Title: In a union, types with index signatures should contribute types to all properties · Issue #21141 · microsoft/TypeScript
Description: Currently, putting a type with nothing but a string index signature in a union prevents all properties from being accessible. Instead, the type should contribute its index type to all properties: type U = { foo: { bar: true }, baz: true ...
Open Graph Description: Currently, putting a type with nothing but a string index signature in a union prevents all properties from being accessible. Instead, the type should contribute its index type to all properties: t...
X Description: Currently, putting a type with nothing but a string index signature in a union prevents all properties from being accessible. Instead, the type should contribute its index type to all properties: t...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/21141
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In a union, types with index signatures should contribute types to all properties","articleBody":"Currently, putting a type with nothing but a string index signature in a union prevents all properties from being accessible. Instead, the type should contribute its index type to all properties:\r\n\r\n```ts\r\ntype U = { foo: { bar: true }, baz: true } | { [key: string]: string };\r\ndeclare var u: U;\r\nu.foo\r\nu.baz\r\n```\r\n\r\nCurrently, `foo` and `baz` are not found on `u`. But they should be present, and have types `{ bar: true } | string` and `true | string` respectively.","author":{"url":"https://github.com/sandersn","@type":"Person","name":"sandersn"},"datePublished":"2018-01-11T16:57:23Z","url":"https://github.com/microsoft/TypeScript/issues/21141"}
| 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:52cc20f0-7099-b0fc-a10e-5e29b61293bb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA20:296654:BCFAFA:FE60A9:6B00F7D9 |
| html-safe-nonce | 9824eb6452b640c2cb28f2585421a14515df99ea765a6eb1c04aa00ec5b9735c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTIwOjI5NjY1NDpCQ0ZBRkE6RkU2MEE5OjZCMDBGN0Q5IiwidmlzaXRvcl9pZCI6IjgwNjI2NTI0NjY4NjY0ODUyMDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0dd55770fad8723b668abf2a751b724c16fad5632c553334d008dc927626279e |
| hovercard-subject-tag | issue:287852609 |
| 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/TypeScript/21141/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e3cc992415ffcac2c72a218cffac337648823d29df4d6d9b935bafccf2a3423/microsoft/TypeScript/issues/21141 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e3cc992415ffcac2c72a218cffac337648823d29df4d6d9b935bafccf2a3423/microsoft/TypeScript/issues/21141 |
| og:image:alt | Currently, putting a type with nothing but a string index signature in a union prevents all properties from being accessible. Instead, the type should contribute its index type to all properties: t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sandersn |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width