Title: Conditional types break with property chaining · Issue #32735 · microsoft/TypeScript · GitHub
Open Graph Title: Conditional types break with property chaining · Issue #32735 · microsoft/TypeScript
X Title: Conditional types break with property chaining · Issue #32735 · microsoft/TypeScript
Description: TypeScript Version: 3.5.1 Search Terms: property chaining, generic, object type param, conditional type Code Modified version of Bruce Pascoe (@fatcerberus) ' attempt to break TS. type Droste
Open Graph Description: TypeScript Version: 3.5.1 Search Terms: property chaining, generic, object type param, conditional type Code Modified version of Bruce Pascoe (@fatcerberus) ' attempt to break TS. type Droste X Description: TypeScript Version: 3.5.1 Search Terms: property chaining, generic, object type param, conditional type Code Modified version of Bruce Pascoe (@fatcerberus) ' attempt to break TS. type Droste&l...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32735
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Conditional types break with property chaining","articleBody":"\u003c!-- 🚨 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!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.5.1\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\n\r\nproperty chaining, generic, object type param, conditional type\r\n\r\n**Code**\r\n\r\nModified version of @fatcerberus ' attempt to break TS.\r\n\r\n```ts\r\ntype Droste\u003cT extends {x:number|string}> = {\r\n value: T,\r\n /**\r\n * Should alternate between string and number\r\n */\r\n droste: Droste\u003c{x:(T[\"x\"] extends number ? string : number)}>\r\n};\r\n\r\ndeclare const droste: Droste\u003c{x:number}>;\r\n\r\n//number\r\nconst _0 = droste.droste.droste.droste.droste.droste.droste.droste.droste.droste.droste\r\n .droste.droste.droste.droste.droste.droste.droste.droste.droste.droste\r\n .droste.droste;\r\nconst _1 = _0.droste; //string\r\nconst _2 = _1.droste; //number\r\nconst _3 = _2.droste; //string\r\n\r\nconst _4 = _3.droste; //Expected number, actual string, ???\r\nconst _5 = _4.droste; //string\r\nconst _6 = _5.droste; //string\r\nconst _7 = _6.droste; //string\r\nconst _8 = _7.droste; //string\r\nconst _9 = _8.droste; //string\r\n//string forever and ever. Where is `number`?\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nEach access to `.droste` should alternate between `string` and `number`.\r\nOr give a max instantiation depth/count error.\r\n\r\n**Actual behavior:**\r\n\r\nIt alternates between `string` and `number` and then breaks after while.\r\nFrom that point, it just sticks with `string`.\r\n\r\nNo errors given.\r\n\r\n**Playground Link:**\r\n\r\n[Playground](https://www.typescriptlang.org/play/#code/C4TwDgpgBAIgTgewM7AgHgCpQgD1QOwBMkoBvHALnwFcBbAIwjgB8U4BLfAcwF8A+KAF4yAKCjioANwCGAG2oQKUDABoxEgPQAqLeolaoAZQAWCarMJQ5qOPmmoojYAHcIEfFDacuVolBoMTHriWhrBhIgoirCRqGjkFAAUGADaAEQ4aQC62HjuxP50jHBQAPyewBzcUEoBxQCU-CI8ANwiIoQQAMay0nDQXQj4KFARyKhK8OPoCXVM-G0iGhpzcCKDw8BQAPoADEKjsRAAdGNRp0cX01fnZ6g393cnTw-PR8Gvny-flz-Xf7d3hIoF8jm0NiNtgBGA57V4tKDLLzcdZDSEAJlhUPhiJWRSCEK22wAzLD0TikZVvO1CTsACyw4kUjQAURwkC6qEsqxUVk51DkFSqXF5pTFqM2OwArLC6czkVwJZCAGywqXyqko2nbADssOVGuFSqJAA5YTrDdTtQBOWEmy0oynCqAAMwQ-UkTF8lggnrgxygAHVjExoOwSAADVYR0pAA)\r\n\r\n**Related Issues:** \r\n\r\nIt is similar to https://github.com/microsoft/TypeScript/issues/32707\r\nExcept, it gives up and resolves the type to `string`, rather than `any`.\r\n","author":{"url":"https://github.com/AnyhowStep","@type":"Person","name":"AnyhowStep"},"datePublished":"2019-08-06T16:03:34Z","url":"https://github.com/microsoft/TypeScript/issues/32735"}
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:6c30126e-0bdb-1010-4b6f-7aacbb764d53 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id A17A:5D487:9F3454:D3D8EF:6B01BCC6 html-safe-nonce c8b2637ab2524dc89290e096d835b8598f0e4793ad56f85bb379c1178ead5eb6 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTdBOjVENDg3OjlGMzQ1NDpEM0Q4RUY6NkIwMUJDQzYiLCJ2aXNpdG9yX2lkIjoiMjU4NDU5NTk4Nzc3MTI3NjQ4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 48855814bb37128398b48c0e6a767313bb470ce5774f629bc71d83dd3dc1ff8f hovercard-subject-tag issue:477467243 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/32735/issue_layout twitter:image https://opengraph.githubassets.com/4a89299b4ccbbfb218d4a4fd6d2ad37579313a6fcb4e715c989a2e4d208c911b/microsoft/TypeScript/issues/32735 twitter:card summary_large_image og:image https://opengraph.githubassets.com/4a89299b4ccbbfb218d4a4fd6d2ad37579313a6fcb4e715c989a2e4d208c911b/microsoft/TypeScript/issues/32735 og:image:alt TypeScript Version: 3.5.1 Search Terms: property chaining, generic, object type param, conditional type Code Modified version of Bruce Pascoe (@fatcerberus) ' attempt to break TS. type Droste og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username AnyhowStep 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.