Title: Cannot read property 'kind' of undefined at Object.parenthesizeArrayTypeMember · Issue #26153 · microsoft/TypeScript · GitHub
Open Graph Title: Cannot read property 'kind' of undefined at Object.parenthesizeArrayTypeMember · Issue #26153 · microsoft/TypeScript
X Title: Cannot read property 'kind' of undefined at Object.parenthesizeArrayTypeMember · Issue #26153 · microsoft/TypeScript
Description: TypeScript Version: 3.1.0-dev.20180802 Search Terms: Cannot read property 'kind' of undefined Optional element in tuple ReadonlyArray Strict mode Code type Foo = [object, object?]; const bar: ReadonlyArray
Open Graph Description: TypeScript Version: 3.1.0-dev.20180802 Search Terms: Cannot read property 'kind' of undefined Optional element in tuple ReadonlyArray Strict mode Code type Foo = [object, object?]; const bar: Reado...
X Description: TypeScript Version: 3.1.0-dev.20180802 Search Terms: Cannot read property 'kind' of undefined Optional element in tuple ReadonlyArray Strict mode Code type Foo = [object, object?]; const ba...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/26153
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot read property 'kind' of undefined at Object.parenthesizeArrayTypeMember","articleBody":"\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.1.0-dev.20180802\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* Cannot read property 'kind' of undefined\r\n* Optional element in tuple\r\n* ReadonlyArray\r\n* Strict mode\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Foo = [object, object?];\r\n\r\nconst bar: ReadonlyArray\u003cFoo> = [{}, {}];\r\n```\r\n\r\n**Expected behavior:**\r\nAn error along the lines of:\r\n```\r\nType '{}[]' is not assignable to type '[object, (object | undefined)?][]\r\n```\r\n\r\n**Actual behavior:**\r\n```\r\n./node_modules/typescript/lib/tsc.js:67968\r\n throw e;\r\n ^\r\n\r\nTypeError: Cannot read property 'kind' of undefined\r\n at Object.parenthesizeArrayTypeMember (./node_modules/typescript/lib/tsc.js:50576:24)\r\n at Object.createOptionalTypeNode (./node_modules/typescript/lib/tsc.js:47850:24)\r\n at typeReferenceToTypeNode (./node_modules/typescript/lib/tsc.js:26572:44)\r\n at typeToTypeNodeHelper (./node_modules/typescript/lib/tsc.js:26383:28)\r\n at typeReferenceToTypeNode (./node_modules/typescript/lib/tsc.js:26560:43)\r\n at typeToTypeNodeHelper (./node_modules/typescript/lib/tsc.js:26383:28)\r\n at signatureToSignatureDeclarationHelper (./node_modules/typescript/lib/tsc.js:26827:52)\r\n at createTypeNodesFromResolvedType (./node_modules/typescript/lib/tsc.js:26666:43)\r\n at createTypeNodeFromObjectType (./node_modules/typescript/lib/tsc.js:26547:35)\r\n at createAnonymousTypeNode (./node_modules/typescript/lib/tsc.js:26502:42)\r\n```\r\n\r\n**Conditions**\r\nIt seems this bug is only triggered if:\r\n* a `ReadonlyArray` is used – `Array` doesn't seem to trigger it\r\n* strict mode is enabled\r\n* the last element of the tuple is optional\r\n\r\n**Playground Link:**\r\n[Playground](https://www.typescriptlang.org/play/#src=type%20Foo%20%3D%20%5Bobject%2C%20object%3F%5D%3B%0D%0A%0D%0Aconst%20bar%3A%20ReadonlyArray%3CFoo%3E%20%3D%20%5B%7B%7D%2C%20%7B%7D%5D%3B%0D%0A). Be sure to enable strictNullChecks to replicate.","author":{"url":"https://github.com/victorwelling","@type":"Person","name":"victorwelling"},"datePublished":"2018-08-02T10:56:21Z","url":"https://github.com/microsoft/TypeScript/issues/26153"}
| 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:2b6429be-9fc3-562b-cecc-8855e72a18f6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBD6:CC1A4:33E3C9C:42072CA:6B01D921 |
| html-safe-nonce | 343bfd782df66766d944babe6d070aed2bd862aa02b6c6f9921ed6a85b285e96 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkQ2OkNDMUE0OjMzRTNDOUM6NDIwNzJDQTo2QjAxRDkyMSIsInZpc2l0b3JfaWQiOiI0NjkyMDY3MjI2NTIwNTA4NzA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 82b85a5efc86b52bc47c9ae91695994e092c2d3a7817ea83a89f81d3525f304d |
| hovercard-subject-tag | issue:346961485 |
| 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/26153/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c7c8baf7a7a3ab14182c22a3bd18db4dc4e103e5bda68a5f919229c8ef1d0025/microsoft/TypeScript/issues/26153 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c7c8baf7a7a3ab14182c22a3bd18db4dc4e103e5bda68a5f919229c8ef1d0025/microsoft/TypeScript/issues/26153 |
| og:image:alt | TypeScript Version: 3.1.0-dev.20180802 Search Terms: Cannot read property 'kind' of undefined Optional element in tuple ReadonlyArray Strict mode Code type Foo = [object, object?]; const bar: Reado... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | victorwelling |
| 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