-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Prettier 3.2.1
Playground link
--parser typescriptInput:
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.
vdumbrav, tomups and CarelessInternet
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.