Title: spread of overloaded function rejected on generic components in JSX as of 4.7.4 · Issue #51577 · microsoft/TypeScript · GitHub
Open Graph Title: spread of overloaded function rejected on generic components in JSX as of 4.7.4 · Issue #51577 · microsoft/TypeScript
X Title: spread of overloaded function rejected on generic components in JSX as of 4.7.4 · Issue #51577 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms spread jsx generic overload 🕗 Version & Regression Information This changed between versions 4.6.4 and 4.7.4 ⏯ Playground Link Playground link with relevant code 💻 Code function GenericComponent
Open Graph Description: Bug Report 🔎 Search Terms spread jsx generic overload 🕗 Version & Regression Information This changed between versions 4.6.4 and 4.7.4 ⏯ Playground Link Playground link with relevant code 💻 Code fu...
X Description: Bug Report 🔎 Search Terms spread jsx generic overload 🕗 Version & Regression Information This changed between versions 4.6.4 and 4.7.4 ⏯ Playground Link Playground link with relevant code 💻 Cod...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/51577
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"spread of overloaded function rejected on generic components in JSX as of 4.7.4","articleBody":"# Bug Report\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n\r\nspread jsx generic overload\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n\u003c!-- When did you start seeing this bug occur?\r\n\r\n\"Bugs\" that have existed in TS for a long time are very likely to be FAQs; refer to\r\n https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs\r\n\r\nIf possible, please try testing the nightly version of TS to see if it's already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n\r\nNote: The TypeScript Playground can be used to try older versions of TypeScript.\r\n\r\nPlease keep and fill in the line that best applies:\r\n-->\r\n- This changed between versions 4.6.4 and 4.7.4\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n A link to a TypeScript Playground \"Share\" link which shows this behavior\r\n\r\n The TypeScript Workbench can be used for more complex setups, try\r\n https://www.typescriptlang.org/dev/bug-workbench/\r\n\r\n As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n-->\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?jsx=4&ts=4.7.4#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQFA0AmWuANspXAQK4B2+wE3OCWAwAPABUANHADScLAA8YWbvXSoYUYNwDmAPgAU3ZCCyoAXHErJ6A5gE9ZAbQC60iACMAVpfEBKSwB5EBEJaRk9AG4GJlZ2Ll4YfkFhMTlFZVV1TW19IxMzS2tbbgdnFwC4CUNPHzh-OABePThg0KlZKLpGFjYsOFwBDSEYAAssKAAFYjALTCZoelENLV1pZG57FoAfOB5GAm0sejpB7mHtZShTemBkZWmIWaahEJgDJzICCAgyNxHxlMZqg-DQzsMwMCAOrQADWuQAktwrjc7soXgBvGhwHFwAB0BMuE1R9ywj1mNAAvtEAPQ0uAAZQKKHQAANIU9UDCoPDdKy4B5OPAAO4iUYQIUoQRE67HNH9ABuyGYnCwYKG8A5s25vJ0ABFgJR8JjsbiCXjUh8vj8-u4xhNySCqdEaAk+AI4ABhEiQbgqd5auYYjg-AD8lhWuTglL8cCxuKsWBgnCggm4nGYzCprp47sEAHEVBNgLhveABP7qgZA5Zg98IOG4JHdNHY-HcZRk6m4OnM9m6KIy77-XHzTKSQ9gZS4DSuqJC36tKWfRXkaPCcjiXLSY7p7PooOV361xjzZbPvXbQCHcC-Hu5wvi8vy8f4KeCefrb9-hB7UDOXeM5dI+S5Dqu7zvhabxWpeP5-o6d5+C6NBAA)\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\nfunction GenericComponent\u003cT>(props: { foo?: string }) {\r\n return null\r\n}\r\nfunction GenericComponent\u003cT>(props: { foo?: string }) {\r\n return null\r\n}\r\n\u003cGenericComponent {...omit(['foo'], otherProps)} />;\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n`Spread types may only be created from object types.(2698)`\r\nunless we save `omit(['foo'], otherProps)` in an intermediate variable and spread that instead (work around in playground).\r\n\r\n### 🙂 Expected behavior\r\n\r\nNo error since it's valid at runtime. It's also accepted by TS without JSX or on non-generic components or if we save the value in an intermediate variable. All cases are explored in the playground.\r\n","author":{"url":"https://github.com/eps1lon","@type":"Person","name":"eps1lon"},"datePublished":"2022-11-17T20:17:10Z","url":"https://github.com/microsoft/TypeScript/issues/51577"}
| 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:4f76e09b-321a-da8b-96d1-40998f1bf00a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E870:1C94F:1E57CA5:26E0AC3:6B01AD3A |
| html-safe-nonce | 7fe0e134821dacfea6775080a7e14819234b56eecdc26fa41f9bfca7c4fc87fc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODcwOjFDOTRGOjFFNTdDQTU6MjZFMEFDMzo2QjAxQUQzQSIsInZpc2l0b3JfaWQiOiIzMzUwOTA4MjQ4OTA2NjQwNjk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b1931d70ff9ce050fb154f21044cff78444e3ce152e976bd28444538d248feea |
| hovercard-subject-tag | issue:1453933002 |
| 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/51577/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f435e5b17ecad8e830408728893a93a0f8868afe8ceb948cf7b48802f4df550/microsoft/TypeScript/issues/51577 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f435e5b17ecad8e830408728893a93a0f8868afe8ceb948cf7b48802f4df550/microsoft/TypeScript/issues/51577 |
| og:image:alt | Bug Report 🔎 Search Terms spread jsx generic overload 🕗 Version & Regression Information This changed between versions 4.6.4 and 4.7.4 ⏯ Playground Link Playground link with relevant code 💻 Code fu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eps1lon |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width