Skip to content

Commit 494fada

Browse files
authored
Merge pull request #9426 from zhengbli/fix9411
Add nullcheck when calculating indentations for implort clause
2 parents ae4bb62 + adca770 commit 494fada

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Diff for: src/services/formatting/smartIndenter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ namespace ts.formatting {
497497
return childKind !== SyntaxKind.NamedExports;
498498
case SyntaxKind.ImportDeclaration:
499499
return childKind !== SyntaxKind.ImportClause ||
500-
(<ImportClause>child).namedBindings.kind !== SyntaxKind.NamedImports;
500+
((<ImportClause>child).namedBindings && (<ImportClause>child).namedBindings.kind !== SyntaxKind.NamedImports);
501501
case SyntaxKind.JsxElement:
502502
return childKind !== SyntaxKind.JsxClosingElement;
503503
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// var expect = require('expect.js');
4+
//// import React from 'react'/*1*/;
5+
//// import { mount } from 'enzyme';
6+
//// require('../setup');
7+
//// var Amount = require('../../src/js/components/amount');
8+
9+
//// describe('<Failed />', () => {
10+
//// var history
11+
//// beforeEach(() => {
12+
//// history = createMemoryHistory();
13+
//// sinon.spy(history, 'pushState');
14+
//// });
15+
16+
//// afterEach(() => {
17+
//// })
18+
19+
//// it('redirects to order summary', () => {
20+
21+
//// });
22+
//// });
23+
24+
format.document();
25+
goTo.marker("1");
26+
verify.currentLineContentIs("import React from 'react';")

0 commit comments

Comments
 (0)