Consider TSNonNullExpression part of member chain (#3442)
parent
c9079926c9
commit
69f05e42c9
|
@ -403,7 +403,8 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
i++;
|
||||
} while (
|
||||
firstNonMemberParent &&
|
||||
firstNonMemberParent.type === "MemberExpression"
|
||||
(firstNonMemberParent.type === "MemberExpression" ||
|
||||
firstNonMemberParent.type === "TSNonNullExpression")
|
||||
);
|
||||
|
||||
const shouldInline =
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`member-chain.js 1`] = `
|
||||
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!;
|
||||
|
||||
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!.anotherObject;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const {
|
||||
somePropThatHasAReallyLongName,
|
||||
anotherPropThatHasALongName
|
||||
} = this.props.imReallySureAboutThis!;
|
||||
|
||||
const {
|
||||
somePropThatHasAReallyLongName,
|
||||
anotherPropThatHasALongName
|
||||
} = this.props.imReallySureAboutThis!.anotherObject;
|
||||
|
||||
`;
|
||||
|
||||
exports[`parens.ts 1`] = `
|
||||
(a ? b : c) ![tokenKey];
|
||||
(a || b) ![tokenKey];
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!;
|
||||
|
||||
const { somePropThatHasAReallyLongName, anotherPropThatHasALongName } = this.props.imReallySureAboutThis!.anotherObject;
|
Loading…
Reference in New Issue