Title: Regression in inference for keys of mapped type with empty object · Issue #22242 · microsoft/TypeScript · GitHub
Open Graph Title: Regression in inference for keys of mapped type with empty object · Issue #22242 · microsoft/TypeScript
X Title: Regression in inference for keys of mapped type with empty object · Issue #22242 · microsoft/TypeScript
Description: interface Style { flashy: any; } declare function mergeStyleSets
Open Graph Description: interface Style { flashy: any; } declare function mergeStyleSets
X Description: interface Style { flashy: any; } declare function mergeStyleSets<K extends string>( ...cssSets: {[P in K]?: Style }[]): {[P in K]: Style }; // Expected: // let x: { // a: Style; // b: Style; ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/22242
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression in inference for keys of mapped type with empty object","articleBody":"```ts\r\ninterface Style {\r\n flashy: any;\r\n}\r\n\r\ndeclare function mergeStyleSets\u003cK extends string>(\r\n ...cssSets: {[P in K]?: Style }[]): {[P in K]: Style };\r\n\r\n// Expected:\r\n// let x: {\r\n// a: Style;\r\n// b: Style;\r\n// }\r\nlet x = mergeStyleSets(\r\n {},\r\n {\r\n a: { flashy: true },\r\n },\r\n {\r\n b: { flashy: true },\r\n },\r\n)\r\n```\r\n\r\nThis code currently causes an error, but previously would lead `x` to have the type `{ a: Style, b: Style }. Removing the `{}` argument seems to restore the original behavior.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2018-02-28T22:29:39Z","url":"https://github.com/microsoft/TypeScript/issues/22242"}
| 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:e60a645b-09a3-38b3-c946-1cd4c8476d2a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 882E:21A483:EA142A:1381BD1:6B040AE0 |
| html-safe-nonce | 4bf30763e212ac1b28935e7b1e8e0b02fe1112e93102120747501fef20210eb6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODJFOjIxQTQ4MzpFQTE0MkE6MTM4MUJEMTo2QjA0MEFFMCIsInZpc2l0b3JfaWQiOiI3MjQxOTgxMTE0MzM3MjI1OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dd3fb835183ea2ce39b2799dd8dc1658185b4cff4c444467cbce7e1569f62c2e |
| hovercard-subject-tag | issue:301208557 |
| 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/22242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ae4c58fbbe8e919f89c113dbf5bb0a6220e6887f16a234f9f1d6d3263cd3541/microsoft/TypeScript/issues/22242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ae4c58fbbe8e919f89c113dbf5bb0a6220e6887f16a234f9f1d6d3263cd3541/microsoft/TypeScript/issues/22242 |
| og:image:alt | interface Style { flashy: any; } declare function mergeStyleSets |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width