-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in getSpecialPropertyAssignmentKind when handling ||
in const value
#15616
Comments
I am unable to reproduce the original issue, can you share more context.. c:\test\15616>type a.js
// (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');
const DEFAULT_MESSAGE = 'Uh-oh, something went wrong...';
class Errors extends Component {
_renderMessage(error) {
const message = error.message || DEFAULT_MESSAGE;
}
}
});
c:\test\15616>type jsconfig.json
{
"compilerOptions": {
"checkJs": true,
"noEmit": true
}
}
c:\test\15616>ls node_modules\@types
[.] [..] [react] [requirejs]
0 File(s) 0 bytes
4 Dir(s) 40,390,402,048 bytes free
c:\test\15616>tsc --v
Version 2.3.2
c:\test\15616>tsc --p jsconfig.json
c:\test\15616>echo %ERRORLEVEL%
0
|
» tsc --version
Version 2.4.0-dev.20170505
» tsc --allowJs --checkJs --strict --noEmit example.js |
Looks like this is blocking the start of our JS -> TS migration. Looking forward to a fix :) |
The better check is just whether the declaration is a BinaryExpression, since multiple kinds of Javascript declarations use assignment, and those are the only declarations whose kind is BinaryExpression. #15594 has this fix too, but I'll give it its own PR to get it in faster. |
OK, fix is up at #15669 |
TypeScript Version: 2.4.0-dev.20170505 (nightly)
Code
# install tsc 20170505 and react 15.4.2 first tsc --allowJs --checkJs --strict --noEmit example.js
Expected behavior:
Does not crash
Actual behavior:
Crashes because operatorToken is not an object, and the code is trying to access expr.operatorToken.kind
Additionally, with this patch to diagnose the cause, I saw more info
Output: https://gist.github.com/TysonAndre/ba9ccf4ada6401d71f877c07f2700dfb
The text was updated successfully, but these errors were encountered: