Title: regression in 5.4: error TS2604: JSX element type 'Cmp' does not have any construct or call signatures. · Issue #57862 · microsoft/TypeScript · GitHub
Open Graph Title: regression in 5.4: error TS2604: JSX element type 'Cmp' does not have any construct or call signatures. · Issue #57862 · microsoft/TypeScript
X Title: regression in 5.4: error TS2604: JSX element type 'Cmp' does not have any construct or call signatures. · Issue #57862 · microsoft/TypeScript
Description: 🔎 Search Terms TS2604 🕗 Version & Regression Information This is a regression, it started happening with 5.4.0 Note that that comment lists 2 issues, now there's only the one TS2604 issue. The issue still exists in @next. ⏯ Playground Li...
Open Graph Description: 🔎 Search Terms TS2604 🕗 Version & Regression Information This is a regression, it started happening with 5.4.0 Note that that comment lists 2 issues, now there's only the one TS2604 issue. The issu...
X Description: 🔎 Search Terms TS2604 🕗 Version & Regression Information This is a regression, it started happening with 5.4.0 Note that that comment lists 2 issues, now there's only the one TS2604 issue. ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/57862
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"regression in 5.4: error TS2604: JSX element type 'Cmp' does not have any construct or call signatures.","articleBody":"### 🔎 Search Terms\n\nTS2604\n\n### 🕗 Version & Regression Information\n\nThis is a regression, it [started happening with 5.4.0](https://github.com/microsoft/TypeScript/issues/57058#issuecomment-1891054672)\r\n\r\nNote that that comment lists 2 issues, now there's only the one TS2604 issue.\r\n\r\nThe issue still exists in @next.\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play?#code/PTAEEsBcHIGdQIoHdwGtQCMCulQHtUBYAKHAFsAHPAJ1wCUBTAQwGNcAzavM0aa5ttBIkQoACoALcPGmh+ARyzh+AE1DsaoSBIYRYsLAwA0oFhKYA7AObhrEXJDxyGkLNQvjQZJqgYzcTKAq4OzsDPwWuOFc1CSQAJ4UugDyGABWDGwAClwUsAA8YgB8oAC8JKCVngwAHpAMFirwjCw0KvmW8SadRRVVAPzifZUAXKAWDABu4QDcwsQJSaAAYlgWbOB4FgDC3FQTkflZZaBrqBZ4SBYlpaAAFBS5sGNZAJRlJZ1zxCJgsJDUWxWAA+7A8sgUSlU6k02l00gMxlM5msQPsWicWwANvFkZl0BpqOoPN5fP5QIFgqFwg0otQYnFErocng8sl2PltskALJZG6gLm80C1eqNeC+eJ4digABSAGUABoAOgAkpFARZYOAWABRLEMMi02DDUCDeXKtUA2xa3X6w2RWAAbUFWQAuiaxi7hXUGk0VmsNltdpQtrT8rYwkTkoCrCy8r1iFVTaBUhlsk98tHwLGngmk2MJtNYj9iK1NbgsngcWUTZzvaK-f8NVZQMD-etIJsdntQ5ETk20W3Vh2u8H9rSincAN4mpNMZ4CygnaDBSbQCnwbZGWdVJV7x6s42JqoAXzGU43-U9oBPoAAZKA47B2fkB3YRb7N8mV+A16BPUU7ylCUM7HkmlSiJIsjBCoFjQHSMQQB4ACsSoAMzoZgODCvSNAyChSoACxKgADDulT8K47igJyS5TnuSoHnkJ5FFI+TANslBFN84FVKI4EAHr9CaJ7zEAA\n\n### 💻 Code\n\n```tsx\r\n// it's Qwik but ok\r\nimport React from 'react'\r\n\r\n// This is required for the issue, changing it to return T makes it a different error\r\ntype ObjectProps\u003cT> =\r\n T extends Record\u003cany, any>\r\n ? T\r\n : never;\r\n\r\ntype FunctionComponent\u003cP = unknown> = (props: P) => any;\r\n\r\n// string|fn is required for the issue, changing it to only check for fn makes it a different error\r\ntype PropsOf\u003cCOMP> = COMP extends keyof JSX.IntrinsicElements\r\n ? JSX.IntrinsicElements[COMP]\r\n : COMP extends FunctionComponent\u003cinfer OrigProps>\r\n ? ObjectProps\u003cOrigProps>\r\n : never\r\n\r\nconst Poly =\r\n \u003cC extends string | FunctionComponent = string | FunctionComponent>({\r\n as: Cmp = 'div' as C,\r\n ...props\r\n }: { as?: C } & PropsOf\u003cstring extends C ? 'div' : C>) => {\r\n // This didn't error in 5.3.3 but errors in 5.4.0\r\n return \u003cCmp {...props}>hi\u003c/Cmp>;\r\n // ^?\r\n }\r\n```\r\n\r\nIn 5.3.3, the type of Cmp is roughly `String|FunctionComponent`, and in 5.4.2 it's `C|(C&string)`\n\n### 🙁 Actual behavior\n\nIt can't determine that Cmp is a function\n\n### 🙂 Expected behavior\n\nIt should determine that Cmp is a valid JSX tag\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/wmertens","@type":"Person","name":"wmertens"},"datePublished":"2024-03-20T10:20:13Z","url":"https://github.com/microsoft/TypeScript/issues/57862"}
| 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:353e2d70-5813-4774-7320-94f2a6013d6f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C73C:1760D:E798AE:12ECA07:6B04E875 |
| html-safe-nonce | 9b3d8d97c850d389027e7df217f671646c74b896662c987ade748f1220c087f2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzNDOjE3NjBEOkU3OThBRToxMkVDQTA3OjZCMDRFODc1IiwidmlzaXRvcl9pZCI6Ijc2NzAxMzIzNzM0MzgzOTI0MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 466d414673c4c76ab9ba3d325137a0907e629820c440af2fb3a8381b9fa03215 |
| hovercard-subject-tag | issue:2197167785 |
| 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/57862/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5513c7e9d67e56d80e1c25fa6d44ecfe081276908cd75ef8151706411f5295dd/microsoft/TypeScript/issues/57862 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5513c7e9d67e56d80e1c25fa6d44ecfe081276908cd75ef8151706411f5295dd/microsoft/TypeScript/issues/57862 |
| og:image:alt | 🔎 Search Terms TS2604 🕗 Version & Regression Information This is a regression, it started happening with 5.4.0 Note that that comment lists 2 issues, now there's only the one TS2604 issue. The issu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wmertens |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| 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 | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| 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