Fix(typescript) non-null identifier same line in chain (#4052)
parent
65b988a989
commit
efd5bde713
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue