Title: Weird behavior with generics in generic tuple types · Issue #41857 · microsoft/TypeScript · GitHub
Open Graph Title: Weird behavior with generics in generic tuple types · Issue #41857 · microsoft/TypeScript
X Title: Weird behavior with generics in generic tuple types · Issue #41857 · microsoft/TypeScript
Description: TypeScript Version: 4.1.2 Search Terms: Tuple generics Generics in function tuple types Code type Act Open Graph Description: TypeScript Version: 4.1.2 Search Terms: Tuple generics Generics in function tuple types Code type Act X Description: TypeScript Version: 4.1.2 Search Terms: Tuple generics Generics in function tuple types Code type Act<S extends object> = { act<I extends ((shape: S) => object)[]>( ...intentions: I ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/41857
X: @github
Domain: github.com
Links:
Viewport: width=device-width
= { act object)[]>( ...intentions: I ): Act & S & UnionToIntersection = { act object)[]>( ...intentions: I ): Act & S &...
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Weird behavior with generics in generic tuple types","articleBody":"\u003c!-- 🚨 STOP 🚨 STOP 🚨 STOP 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!--\r\nPlease try to reproduce the issue with the latest published version. It may have 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\n**TypeScript Version:** 4.1.2\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\nTuple generics\r\nGenerics in function tuple types\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Act\u003cS extends object> = {\r\n act\u003cI extends ((shape: S) => object)[]>(\r\n ...intentions: I\r\n ): Act\u003cS> & S & UnionToIntersection\u003cReturnType\u003cI[number]>>;\r\n};\r\n```\r\n\r\n**Expected behavior:**\r\nOnce S is provided, The 'act' function should automatically infer the specific type of S, which is constant for every element of the tuple type (I), and make the 'shape' parameter typesafe.\r\nThis behavior works correctly when:\r\n```ts\r\n// Without tuple type\r\ntype Act\u003cS extends object> = {\r\n act\u003cI extends object>(\r\n ...intentions: ((shape: S) => I)[]\r\n ): Act\u003cS> & S & I;\r\n};\r\n```\r\n\r\n**Actual behavior:**\r\nS is inferred as object, instead of its specific type. The return type is inferred correctly.\r\n\r\n**Playground Link:** https://www.typescriptlang.org/play?#code/C4TwDgpgBAqgdgSwPZwCpIJJ2BATgZwgGNhk4AeGAPigF4oAKGKCADxzgBN8oBDOEFAD8jMAC5YASjo0AbkgScoEuBFl5pbDt0YAoKFHFQEcAGZ4oGXdNpyFnfcMuOVavAG5Hu0JCgBBEnIAZRZ2CC4eJAAjACtiYBp6AG9HXkCMUO0eBgZ8AAteSAkgmxpouJJJAG0AXSoGRwMAOhaTDlIUfAkrA0kJAOBgmgAyKBDR+DJ0LBwCeLJyACUIYABXXDRwCHIMKrhVgFsovDqqTwBfdyA\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n","author":{"url":"https://github.com/maxludovicohofer","@type":"Person","name":"maxludovicohofer"},"datePublished":"2020-12-07T16:48:22Z","url":"https://github.com/microsoft/TypeScript/issues/41857"}
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:0b900a77-74a8-4d22-3991-9096e3fe6864 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id A99C:38EE04:B66C14:F1C17F:6B01C124 html-safe-nonce 3e624f4029a828cad7760ce2f55a570c2599846ab916c56285f82d7db094ce28 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTlDOjM4RUUwNDpCNjZDMTQ6RjFDMTdGOjZCMDFDMTI0IiwidmlzaXRvcl9pZCI6Ijg0ODA2NzAyMjIwNTgxMTEyNjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac c4dad6d621b553febbf8ac3ec83b0fd2f129502788f7c4abe861f85a0d5ecaf3 hovercard-subject-tag issue:758673462 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/41857/issue_layout twitter:image https://opengraph.githubassets.com/172075d13cd8285f89eea49332b01118c1d6806ae76cb0d5238be92bd6319cb8/microsoft/TypeScript/issues/41857 twitter:card summary_large_image og:image https://opengraph.githubassets.com/172075d13cd8285f89eea49332b01118c1d6806ae76cb0d5238be92bd6319cb8/microsoft/TypeScript/issues/41857 og:image:alt TypeScript Version: 4.1.2 Search Terms: Tuple generics Generics in function tuple types Code type Act = { act object)[]>( ...intentions: I ): Act & S &...og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username maxludovicohofer 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
URLs of crawlers that visited me.