Title: React: Type inference not working for ref callback · Issue #16019 · microsoft/TypeScript · GitHub
Open Graph Title: React: Type inference not working for ref callback · Issue #16019 · microsoft/TypeScript
X Title: React: Type inference not working for ref callback · Issue #16019 · microsoft/TypeScript
Description: Type inference is not working for the ref callback prop. I believe this is the same issue as in #7088, which was fixed over a year ago. TypeScript Version: 2.3.2 Code // A *self-contained* demonstration of the problem follows... class Ot...
Open Graph Description: Type inference is not working for the ref callback prop. I believe this is the same issue as in #7088, which was fixed over a year ago. TypeScript Version: 2.3.2 Code // A *self-contained* demonstr...
X Description: Type inference is not working for the ref callback prop. I believe this is the same issue as in #7088, which was fixed over a year ago. TypeScript Version: 2.3.2 Code // A *self-contained* demonstr...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/16019
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"React: Type inference not working for ref callback","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\nType inference is not working for the ``ref`` callback prop.\r\nI believe this is the same issue as in #7088, which was fixed over a year ago.\r\n\r\n**TypeScript Version:** 2.3.2\r\n\r\n**Code**\r\n\r\n```ts\r\n// A *self-contained* demonstration of the problem follows...\r\nclass Other extends React.Component\u003cany, any> {\r\n\trender() {\r\n\t\treturn \u003cdiv />;\r\n\t}\r\n}\r\n\r\nclass Container extends React.Component\u003cany, any> {\r\n\tprivate _ref: Other;\r\n\r\n\trender() {\r\n // Parameter 'ref' implicitly has an 'any' type.\r\n\t\treturn \u003cOther ref={ ref => this._ref = ref } />;\r\n\t}\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nType of parameter ``ref`` should be inferred as ``Test``\r\n\r\n**Actual behavior:**\r\nParameter 'ref' implicitly has an 'any' type.","author":{"url":"https://github.com/simonvizzini","@type":"Person","name":"simonvizzini"},"datePublished":"2017-05-23T09:53:06Z","url":"https://github.com/microsoft/TypeScript/issues/16019"}
| 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:c2517dbb-f7e3-d796-593e-65a1e4ca45cf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFE2:1F2B:2E4B5B:3E3F88:6B01937A |
| html-safe-nonce | a8d2b0934aa9780121b92f2923c0a60f59ce042af7f2990c31131af25a679db4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkUyOjFGMkI6MkU0QjVCOjNFM0Y4ODo2QjAxOTM3QSIsInZpc2l0b3JfaWQiOiIzNDk5ODkwMjU3Njk5MTE1ODk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 062c0a4705374420391028bd5a396d66a57cf5005d26168d93fa6dd10b05f82d |
| hovercard-subject-tag | issue:230650942 |
| 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/16019/issue_layout |
| twitter:image | https://opengraph.githubassets.com/142c92e4fd7672ff535ad3005e9cfaff0d2cf6fb4a0aa0aa0d214b2d72d3092d/microsoft/TypeScript/issues/16019 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/142c92e4fd7672ff535ad3005e9cfaff0d2cf6fb4a0aa0aa0d214b2d72d3092d/microsoft/TypeScript/issues/16019 |
| og:image:alt | Type inference is not working for the ref callback prop. I believe this is the same issue as in #7088, which was fixed over a year ago. TypeScript Version: 2.3.2 Code // A *self-contained* demonstr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | simonvizzini |
| 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