Fix(typescript) non-null identifier same line in chain (#4052)

This commit is contained in:
Eric Anderson authored and Lucas Duailibe committed 2018-02-26 15:12:03 -03:00
1 parent 65b988a989
commit efd5bde713
3 files changed
+10

No files matched your search

+1
View File
@@ -4006,6 +4006,7 @@ function printMemberChain(path, options, print) {
let i = 1;
for (; i < printedNodes.length; ++i) {
if (
printedNodes[i].node.type === "TSNonNullExpression" ||
printedNodes[i].node.type === "CallExpression" ||
(printedNodes[i].node.type === "MemberExpression" &&
printedNodes[i].node.computed &&
@@ -6,6 +6,8 @@ const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.pro
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!.anotherObject;
this.foo.get("bar")!.doThings().more();
foo!.bar().baz().what();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const {
somePropThatHasAReallyLongName,
@@ -22,6 +24,11 @@ this.foo
.doThings()
.more();
foo!
.bar()
.baz()
.what();
`;
exports[`parens.ts 1`] = `
@@ -3,3 +3,5 @@ const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.pro
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!.anotherObject;
this.foo.get("bar")!.doThings().more();
foo!.bar().baz().what();