- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
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');
    const DEFAULT_MESSAGE = 'Uh-oh, something went wrong...';
    class Errors extends Component {
        _renderMessage(error) {
            const message = error.message || DEFAULT_MESSAGE;
        }
    }
});# install tsc 20170505 and react 15.4.2 first
tsc --allowJs --checkJs --strict --noEmit example.jsExpected 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
    function getSpecialPropertyAssignmentKind(expression) {
        if (!isInJavaScriptFile(expression)) {
            return 0;
        }     
        var expr = expression;
// begin patch
        if (!expr.operatorToken) {
            console.log('getSpecialPropertyAssignmentKind op', expr);  // This logged, for the '||' operator?
            return 0;
        }     
        if (!expr.left) {
            console.log('getSpecialPropertyAssignmentKind left', expr);
            return 0;
        } 
// end patchOutput: https://gist.github.com/TysonAndre/ba9ccf4ada6401d71f877c07f2700dfb
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue