Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'type') #15912

Closed
epmatsw opened this issue Jan 12, 2024 · 2 comments · Fixed by #15915
Closed

TypeError: Cannot read properties of undefined (reading 'type') #15912

epmatsw opened this issue Jan 12, 2024 · 2 comments · Fixed by #15915
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! type:bug Issues identifying ugly output, or a defect in the program

Comments

@epmatsw
Copy link

epmatsw commented Jan 12, 2024

Prettier 3.2.0
Playground link

--parser typescript

Input:

test()
	.test2()
	.test2(thing?.something);

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:289)
    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 Ta (https://prettier.io/lib/plugins/estree.js:36:58423)

Expected output:

Not exactly sure, it's an error.

Why?

This was not an error in 3.1.x.

@sosukesuzuki
Copy link
Member

Thank you! I'll look into this

@sosukesuzuki sosukesuzuki added type:bug Issues identifying ugly output, or a defect in the program priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! lang:javascript Issues affecting JS labels Jan 12, 2024
@sosukesuzuki
Copy link
Member

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Apr 12, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants