Title: tsc crashes resolving a type of computed property in destructiring assignment · Issue #26321 · microsoft/TypeScript · GitHub
Open Graph Title: tsc crashes resolving a type of computed property in destructiring assignment · Issue #26321 · microsoft/TypeScript
X Title: tsc crashes resolving a type of computed property in destructiring assignment · Issue #26321 · microsoft/TypeScript
Description: TypeScript Version: 3.1.0-dev.20180809, 3.0.1 Search Terms: Cannot read property 'charCodeAt' of undefined Code interface Limit1 { propName: { min: number; max: number }; } interface Limit2 { propName: { min: number; max: number }; } typ...
Open Graph Description: TypeScript Version: 3.1.0-dev.20180809, 3.0.1 Search Terms: Cannot read property 'charCodeAt' of undefined Code interface Limit1 { propName: { min: number; max: number }; } interface Limit2 { propN...
X Description: TypeScript Version: 3.1.0-dev.20180809, 3.0.1 Search Terms: Cannot read property 'charCodeAt' of undefined Code interface Limit1 { propName: { min: number; max: number }; } interface Limit2...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/26321
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"tsc crashes resolving a type of computed property in destructiring assignment","articleBody":"**TypeScript Version:** 3.1.0-dev.20180809, 3.0.1\r\n\r\n**Search Terms:**\r\nCannot read property 'charCodeAt' of undefined\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface Limit1 {\r\n propName: { min: number; max: number };\r\n}\r\ninterface Limit2 {\r\n propName: { min: number; max: number };\r\n}\r\n\r\ntype Limit = Limit1 | Limit2; // should be Union type\r\n\r\nexport interface Meta {\r\n propName: \"propName\";\r\n}\r\n\r\nfunction foo (meta: Meta, limits: Limit): void {\r\n const {\r\n [`propName`]: { min: minBonus, max: maxBonus }, // should be computed\r\n } = limits;\r\n}\r\n\r\n```\r\n\r\n**Expected behavior:**\r\nNo crash, code compiled\r\n\r\n**Actual behavior:**\r\n\r\n\u003cdetails>\r\n \u003csummary>\u003ccode>Cannot read property 'charCodeAt' of undefined\u003c/code>\u003c/summary>\r\n \u003cpre>\r\n.../node_modules/typescript/lib/tsc.js:68035\r\n throw e;\r\n ^\r\n\r\nTypeError: Cannot read property 'charCodeAt' of undefined\r\n at isLateBoundName (.../node_modules/typescript/lib/tsc.js:28756:25)\r\n at createUnionOrIntersectionProperty (.../node_modules/typescript/lib/tsc.js:29638:38)\r\n at getUnionOrIntersectionProperty (.../node_modules/typescript/lib/tsc.js:29699:28)\r\n at getPropertyOfUnionOrIntersectionType (.../node_modules/typescript/lib/tsc.js:29707:28)\r\n at getPropertyOfType (.../node_modules/typescript/lib/tsc.js:29727:24)\r\n at checkVariableLikeDeclaration (.../node_modules/typescript/lib/tsc.js:43025:36)\r\n at checkBindingElement (.../node_modules/typescript/lib/tsc.js:43123:20)\r\n at checkSourceElement (.../node_modules/typescript/lib/tsc.js:44827:28)\r\n at Object.forEach (.../node_modules/typescript/lib/tsc.js:168:30)\r\n at checkVariableLikeDeclaration (.../node_modules/typescript/lib/tsc.js:43036:20)\r\n\r\n\u003c/pre>\r\n\u003c/details>\r\n\r\n\r\n\r\n[**Playground Link:**](https://www.typescriptlang.org/play/index.html#src=interface%20Limit1%20%7B%0A%20%20%20%20propName%3A%20number%3B%0A%7D%0Ainterface%20Limit2%20%7B%0A%20%20%20%20propName%3A%20number%3B%0A%7D%0A%0Atype%20Limit%20%3D%20Limit1%20%7C%20Limit2%3B%20%2F%2F%20should%20be%20Union%20type%0A%0Aexport%20interface%20Meta%20%7B%0A%20%20%20%20propName%3A%20%22propName%22%3B%0A%7D%0A%0Afunction%20foo%20(limits%3A%20Limit)%3A%20void%20%7B%0A%20%20%20%20const%20%7B%0A%20%20%20%20%20%20%20%20%5B%60propName%60%5D%3A%20minBonus%2C%20%2F%2F%20should%20be%20computed%0A%20%20%20%20%7D%20%3D%20limits%3B%0A%7D%0A)\r\n\r\n_Note, that the code is not compiled_","author":{"url":"https://github.com/pablobirukov","@type":"Person","name":"pablobirukov"},"datePublished":"2018-08-09T11:54:16Z","url":"https://github.com/microsoft/TypeScript/issues/26321"}
| 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:450add0c-0b1d-4599-3233-947e30593608 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D016:DA744:2486DD2:312D829:6B01AB32 |
| html-safe-nonce | 9ae44b54b1641d89f3489a7cda448c551270510e7f935ad1fcd532da597218d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDE2OkRBNzQ0OjI0ODZERDI6MzEyRDgyOTo2QjAxQUIzMiIsInZpc2l0b3JfaWQiOiIxODc4NDQwMDQzNjA2MDI3MDU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2ca1cf987cddcf43ce4525aa3e0d78a1292a3abf47b0e5dbf6478c72ae055a40 |
| hovercard-subject-tag | issue:349095215 |
| 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/26321/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ae9bb0565d5f2ee639ea4d1d6e674501b01bcf39d7a01b62c46fb9f3035df5db/microsoft/TypeScript/issues/26321 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ae9bb0565d5f2ee639ea4d1d6e674501b01bcf39d7a01b62c46fb9f3035df5db/microsoft/TypeScript/issues/26321 |
| og:image:alt | TypeScript Version: 3.1.0-dev.20180809, 3.0.1 Search Terms: Cannot read property 'charCodeAt' of undefined Code interface Limit1 { propName: { min: number; max: number }; } interface Limit2 { propN... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pablobirukov |
| 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