Prettier 3.2.1
Playground link
Input:
const randomFuncion = (value): void => {
if (value.a) {
funcA(
"",
funcB(
dayjs(value.a?.toString())
.add(1, "day")
.toISOString()
)
);
}
};
Output:
TypeError: Cannot read properties of undefined (reading 'type')
at Jn (https://prettier.io/lib/plugins/estree.js:7:16595)
at be (https://prettier.io/lib/plugins/estree.js:9:605)
at be (https://prettier.io/lib/plugins/estree.js:10:209)
at https://prettier.io/lib/plugins/estree.js:36:14282
at Array.every (<anonymous>)
at https://prettier.io/lib/plugins/estree.js:36:14273
at Array.some (<anonymous>)
at Oi (https://prettier.io/lib/plugins/estree.js:36:14252)
at Kr (https://prettier.io/lib/plugins/estree.js:36:14852)
at da (https://prettier.io/lib/plugins/estree.js:36:58423)
Expected output:
const randomFuncion = (value): void => {
if (value.a) {
funcA(
"",
funcB(dayjs(value.a?.toString())
.add(1, "day")
.toISOString()
)
);
}
};
Why?
That was not an Error in 3.1.1 here the error in version 3.2.0 which should be fixed in #15912
If I remove the question mark behind the funcB(dayjs(value.a? ... the error is gone.
Prettier 3.2.1
Playground link
Input:
Output:
Expected output:
Why?
That was not an Error in 3.1.1 here the error in version 3.2.0 which should be fixed in #15912
If I remove the question mark behind the
funcB(dayjs(value.a? ...the error is gone.