mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 05:41:22 -06:00
Merge pull request #9426 from zhengbli/fix9411
Add nullcheck when calculating indentations for implort clause
This commit is contained in:
commit
494fada879
@ -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;
|
||||
}
|
||||
|
||||
26
tests/cases/fourslash/formattingIllegalImportClause.ts
Normal file
26
tests/cases/fourslash/formattingIllegalImportClause.ts
Normal 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';")
|
||||
Loading…
x
Reference in New Issue
Block a user