Title: Regression - able to use union containing non-indexing type as index · Issue #26714 · microsoft/TypeScript · GitHub
Open Graph Title: Regression - able to use union containing non-indexing type as index · Issue #26714 · microsoft/TypeScript
X Title: Regression - able to use union containing non-indexing type as index · Issue #26714 · microsoft/TypeScript
Description: TypeScript Version: master at bd40583 Search Terms: array index union error Code declare const arr1: (string | string[])[]; declare const arr2: number[]; const j = arr2[arr1[0]]; Expected behavior: Error - Type string[] cannot be used as...
Open Graph Description: TypeScript Version: master at bd40583 Search Terms: array index union error Code declare const arr1: (string | string[])[]; declare const arr2: number[]; const j = arr2[arr1[0]]; Expected behavior:...
X Description: TypeScript Version: master at bd40583 Search Terms: array index union error Code declare const arr1: (string | string[])[]; declare const arr2: number[]; const j = arr2[arr1[0]]; Expected behavior:...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/26714
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression - able to use union containing non-indexing type as index","articleBody":"**TypeScript Version:** master at bd40583beb10165fd9\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** array index union error\r\n\r\n**Code**\r\n\r\n```ts\r\ndeclare const arr1: (string | string[])[];\r\ndeclare const arr2: number[];\r\nconst j = arr2[arr1[0]];\r\n```\r\n\r\n**Expected behavior:** Error - Type `string[]` cannot be used as an index type\r\n\r\n**Actual behavior:** No error\r\n\r\n**Playground Link:** [Link](http://www.typescriptlang.org/play/#src=declare%20const%20arr1%3A%20(string%20%7C%20string%5B%5D)%5B%5D%3B%0D%0Adeclare%20const%20arr2%3A%20number%5B%5D%3B%0D%0Aconst%20j%20%3D%20arr2%5Barr1%5B0%5D%5D%3B%0D%0A)\r\n\r\n**Related Issues:** Regressed during fix of #26409 (**edit**: #26281 ?)\r\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2018-08-28T16:44:27Z","url":"https://github.com/microsoft/TypeScript/issues/26714"}
| 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:46612fe3-8c3c-3af7-3d6e-adbccbb6f9e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84AC:928E2:26E2CDD:33EC36B:6B01AC4F |
| html-safe-nonce | a3032733aea3c23c28b4ada9777ecbd7bc49e8ce3c6b17d7a70e60a99205b526 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEFDOjkyOEUyOjI2RTJDREQ6MzNFQzM2Qjo2QjAxQUM0RiIsInZpc2l0b3JfaWQiOiIzNTE2MDQ2MjYyNTE0MzMwNzAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 58f862e55c719600ed74f31ad1ebb1b5fc0342ed4ff6c8c8b04d2d378013031a |
| hovercard-subject-tag | issue:354814714 |
| 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/26714/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4927a86a49db50d8edc289f5c095fd71cb2f89095c032f0beb78aecf409e062b/microsoft/TypeScript/issues/26714 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4927a86a49db50d8edc289f5c095fd71cb2f89095c032f0beb78aecf409e062b/microsoft/TypeScript/issues/26714 |
| og:image:alt | TypeScript Version: master at bd40583 Search Terms: array index union error Code declare const arr1: (string | string[])[]; declare const arr2: number[]; const j = arr2[arr1[0]]; Expected behavior:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RyanCavanaugh |
| 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