Merge pull request #9426 from zhengbli/fix9411

Add nullcheck when calculating indentations for implort clause
This commit is contained in:
Zhengbo Li 2016-06-30 14:21:11 -07:00 committed by GitHub
commit 494fada879
2 changed files with 27 additions and 1 deletions

View File

@ -497,7 +497,7 @@ namespace ts.formatting {
return childKind !== SyntaxKind.NamedExports;
case SyntaxKind.ImportDeclaration:
return childKind !== SyntaxKind.ImportClause ||
(<ImportClause>child).namedBindings.kind !== SyntaxKind.NamedImports;
((<ImportClause>child).namedBindings && (<ImportClause>child).namedBindings.kind !== SyntaxKind.NamedImports);
case SyntaxKind.JsxElement:
return childKind !== SyntaxKind.JsxClosingElement;
}

View File

@ -0,0 +1,26 @@
/// <reference path='fourslash.ts' />
//// var expect = require('expect.js');
//// import React from 'react'/*1*/;
//// import { mount } from 'enzyme';
//// require('../setup');
//// var Amount = require('../../src/js/components/amount');
//// describe('<Failed />', () => {
//// var history
//// beforeEach(() => {
//// history = createMemoryHistory();
//// sinon.spy(history, 'pushState');
//// });
//// afterEach(() => {
//// })
//// it('redirects to order summary', () => {
//// });
//// });
format.document();
goTo.marker("1");
verify.currentLineContentIs("import React from 'react';")