Title: Exception in getSpecialPropertyAssignmentKind when handling `||` in const value · Issue #15616 · microsoft/TypeScript · GitHub
Open Graph Title: Exception in getSpecialPropertyAssignmentKind when handling `||` in const value · Issue #15616 · microsoft/TypeScript
X Title: Exception in getSpecialPropertyAssignmentKind when handling `||` in const value · Issue #15616 · microsoft/TypeScript
Description: TypeScript Version: 2.4.0-dev.20170505 (nightly) Code // (Using react version "15.4.2") // This is a .js file, using --checkJS (and extra lines were cut out) define(function(require) { 'use strict'; const { Component} = require('react');...
Open Graph Description: TypeScript Version: 2.4.0-dev.20170505 (nightly) Code // (Using react version "15.4.2") // This is a .js file, using --checkJS (and extra lines were cut out) define(function(require) { 'use strict'...
X Description: TypeScript Version: 2.4.0-dev.20170505 (nightly) Code // (Using react version "15.4.2") // This is a .js file, using --checkJS (and extra lines were cut out) define(function(require) { ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/15616
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exception in getSpecialPropertyAssignmentKind when handling `||` in const value","articleBody":"**TypeScript Version:** 2.4.0-dev.20170505 (nightly)\r\n\r\n**Code**\r\n\r\n\r\n```javascript\r\n// (Using react version \"15.4.2\")\r\n// This is a .js file, using --checkJS (and extra lines were cut out)\r\ndefine(function(require) {\r\n 'use strict';\r\n\r\n const { Component} = require('react');\r\n\r\n const DEFAULT_MESSAGE = 'Uh-oh, something went wrong...';\r\n\r\n class Errors extends Component {\r\n _renderMessage(error) {\r\n const message = error.message || DEFAULT_MESSAGE;\r\n }\r\n }\r\n});\r\n```\r\n\r\n\r\n```bash\r\n# install tsc 20170505 and react 15.4.2 first\r\ntsc --allowJs --checkJs --strict --noEmit example.js\r\n```\r\n\r\n**Expected behavior:**\r\nDoes not crash\r\n**Actual behavior:**\r\nCrashes because operatorToken is not an object, and the code is trying to access expr.operatorToken.kind\r\n\r\nAdditionally, with this patch to diagnose the cause, I saw more info\r\n\r\n```js\r\n function getSpecialPropertyAssignmentKind(expression) {\r\n if (!isInJavaScriptFile(expression)) {\r\n return 0;\r\n } \r\n var expr = expression;\r\n// begin patch\r\n if (!expr.operatorToken) {\r\n console.log('getSpecialPropertyAssignmentKind op', expr); // This logged, for the '||' operator?\r\n return 0;\r\n } \r\n if (!expr.left) {\r\n console.log('getSpecialPropertyAssignmentKind left', expr);\r\n return 0;\r\n } \r\n// end patch\r\n```\r\n\r\nOutput: https://gist.github.com/TysonAndre/ba9ccf4ada6401d71f877c07f2700dfb","author":{"url":"https://github.com/TysonAndre","@type":"Person","name":"TysonAndre"},"datePublished":"2017-05-05T20:03:14Z","url":"https://github.com/microsoft/TypeScript/issues/15616"}
| 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:bd70ea8e-af25-4a1d-14f8-6ec97d922f86 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A76E:DA744:7364DD:9CBF7C:6B00DE78 |
| html-safe-nonce | ee52d0ebfdf73911304198bb6d63a746af3588fc8eff27993738b600c4e4c8bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzZFOkRBNzQ0OjczNjRERDo5Q0JGN0M6NkIwMERFNzgiLCJ2aXNpdG9yX2lkIjoiNTQ3ODIzMTExODU1NTcwMDg1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 09fd5a4ba635a3074549c077d97b5aea0723e09be4aab7ba8d2311ac15f39027 |
| hovercard-subject-tag | issue:226677600 |
| 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/15616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8427339f3df14c9833b2d8a54ef1e824722276882e33fbcff6b47e2f3c329fba/microsoft/TypeScript/issues/15616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8427339f3df14c9833b2d8a54ef1e824722276882e33fbcff6b47e2f3c329fba/microsoft/TypeScript/issues/15616 |
| og:image:alt | TypeScript Version: 2.4.0-dev.20170505 (nightly) Code // (Using react version "15.4.2") // This is a .js file, using --checkJS (and extra lines were cut out) define(function(require) { 'use strict'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TysonAndre |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width