René's URL Explorer Experiment


Title: Manually constructed nullish coalescing AST is missing parentheses when printed · Issue #61369 · microsoft/TypeScript · GitHub

Open Graph Title: Manually constructed nullish coalescing AST is missing parentheses when printed · Issue #61369 · microsoft/TypeScript

X Title: Manually constructed nullish coalescing AST is missing parentheses when printed · Issue #61369 · microsoft/TypeScript

Description: 🔎 Search Terms nullish coalescing parentheses ast 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about nullish coalescing ⏯ Playground Link https://stackblitz.com/edit...

Open Graph Description: 🔎 Search Terms nullish coalescing parentheses ast 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about nullish coalescing ⏯ Pla...

X Description: 🔎 Search Terms nullish coalescing parentheses ast 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about nullish coalescing ⏯...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/61369

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Manually constructed nullish coalescing AST is missing parentheses when printed","articleBody":"### 🔎 Search Terms\n\nnullish coalescing parentheses ast\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about nullish coalescing\n\n\n### ⏯ Playground Link\n\nhttps://stackblitz.com/edit/vitejs-vite-letuvqes?file=src%2Fmain.ts\n\n### 💻 Code\n\n```ts\nimport * as ts from 'typescript';\n\nconst printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\nconst src = ts.createSourceFile('test.ts', '', ts.ScriptTarget.Latest);\n\nconst nullishNode = ts.factory.createExpressionStatement(\n  ts.factory.createBinaryExpression(\n    ts.factory.createConditionalExpression(\n      ts.factory.createIdentifier('a'),\n      ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n      ts.factory.createIdentifier('b'),\n      ts.factory.createToken(ts.SyntaxKind.ColonToken),\n      ts.factory.createIdentifier('c')\n    ),\n    ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),\n    ts.factory.createIdentifier('d')\n  )\n);\n\nconst orNode = ts.factory.createExpressionStatement(\n  ts.factory.createBinaryExpression(\n    ts.factory.createConditionalExpression(\n      ts.factory.createIdentifier('a'),\n      ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n      ts.factory.createIdentifier('b'),\n      ts.factory.createToken(ts.SyntaxKind.ColonToken),\n      ts.factory.createIdentifier('c')\n    ),\n    ts.factory.createToken(ts.SyntaxKind.BarBarToken),\n    ts.factory.createIdentifier('d')\n  )\n);\n\n// a ? b : c ?? d\nconst nullish = printer.printNode(ts.EmitHint.Unspecified, nullishNode, src);\n// (a ? b : c) || d\nconst or = printer.printNode(ts.EmitHint.Unspecified, orNode, src);\n```\n\n\n### 🙁 Actual behavior\n\nWhen I manually create AST for the expression `(a ? b : c) ?? d` but leave the parentheses out of the AST, the generated code does not add the parens back in and therefore does not match the structure of the AST.\n\nWhen I do this same thing with `||` or `&&` it behaves as expected, inserting the parens back in to the generated code.\n\n### 🙂 Expected behavior\n\nThe `nullishNode` should be printed in the same way the `orNode` is in the example, adding back in the parentheses so that the code matches the structure of the AST\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/mmalerba","@type":"Person","name":"mmalerba"},"datePublished":"2025-03-07T01:46:33Z","url":"https://github.com/microsoft/TypeScript/issues/61369"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e1706095-5295-1460-3d63-ae6194c72b82
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE24C:28815B:67C6B8:8C67E9:6B00D737
html-safe-nonce3372c9b9b7de82849062f91544dab84fb2d21f50ece44b95eab2c05ecbb40d30
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjRDOjI4ODE1Qjo2N0M2Qjg6OEM2N0U5OjZCMDBENzM3IiwidmlzaXRvcl9pZCI6Ijg2NjA3MjE4NzgyNDA5MDkxMTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc9c7eefd23921a9764b829f41ce9e8547df9c838e05fa26dec53723825506c34
hovercard-subject-tagissue:2901794678
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/61369/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f8d93a8320edc724204e71adc295fc7afc52f90d22f93c972bc9fcd11424392e/microsoft/TypeScript/issues/61369
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f8d93a8320edc724204e71adc295fc7afc52f90d22f93c972bc9fcd11424392e/microsoft/TypeScript/issues/61369
og:image:alt🔎 Search Terms nullish coalescing parentheses ast 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about nullish coalescing ⏯ Pla...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemmalerba
hostnamegithub.com
expected-hostnamegithub.com
Nonea481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release84c8c5cc25e2fb7f2308428458538436baecc6d2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/61369#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F61369
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F61369
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/61369
Reloadhttps://github.com/microsoft/TypeScript/issues/61369
Reloadhttps://github.com/microsoft/TypeScript/issues/61369
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/61369
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/61369
#61372https://github.com/microsoft/TypeScript/pull/61372
Manually constructed nullish coalescing AST is missing parentheses when printedhttps://github.com/microsoft/TypeScript/issues/61369#top
#61372https://github.com/microsoft/TypeScript/pull/61372
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/mmalerba
Miles Malerba (mmalerba)https://github.com/mmalerba
on Mar 7, 2025https://github.com/microsoft/TypeScript/issues/61369#issue-2901794678
https://stackblitz.com/edit/vitejs-vite-letuvqes?file=src%2Fmain.tshttps://stackblitz.com/edit/vitejs-vite-letuvqes?file=src%2Fmain.ts
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Help Wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Help%20Wanted%22
on Mar 10, 2025https://github.com/microsoft/TypeScript/issues/61369#event-16657521216
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Mar 10, 2025https://github.com/microsoft/TypeScript/issues/61369#event-16657521602
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Apr 11, 2025https://github.com/microsoft/TypeScript/issues/61369#event-17220622237
Jake Bailey (jakebailey)https://github.com/jakebailey
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#61372https://github.com/microsoft/TypeScript/pull/61372
on Jun 30, 2025https://github.com/microsoft/TypeScript/issues/61369#event-18394624950
Matthieu Riegler (JeanMeche)https://github.com/JeanMeche
on Aug 20, 2025https://github.com/microsoft/TypeScript/issues/61369#event-19255036036
fix(compiler): Keep paraenthesis in Nullish + Boolean expression.https://github.com/JeanMeche/angular/commit/49832a36f8e237f6c80028e995f6fcb86103342a
49832a3https://github.com/JeanMeche/angular/commit/49832a36f8e237f6c80028e995f6fcb86103342a
fix(compiler): Keep paraenthesis in Nullish + Boolean expression.https://github.com/JeanMeche/angular/commit/074e948c332b14684427d144365b62d3401a86d2
074e948https://github.com/JeanMeche/angular/commit/074e948c332b14684427d144365b62d3401a86d2
fix(compiler): Keep paraenthesis in Nullish + Boolean expression.https://github.com/JeanMeche/angular/commit/fdf999da56a471dd4a985e142541a4296eac73c2
fdf999dhttps://github.com/JeanMeche/angular/commit/fdf999da56a471dd4a985e142541a4296eac73c2
Kristiyan Kostadinov (crisbeto)https://github.com/crisbeto
on Aug 21, 2025https://github.com/microsoft/TypeScript/issues/61369#event-19263167916
fix(compiler): Keep paraenthesis in Nullish + Boolean expression. (#6…https://github.com/angular/angular/commit/a28672fb7017cc62e42829c5910c3b39373d7913
#6…https://github.com/angular/angular/pull/63292
a28672fhttps://github.com/angular/angular/commit/a28672fb7017cc62e42829c5910c3b39373d7913
fix(compiler): Keep paraenthesis in Nullish + Boolean expression. (#6…https://github.com/angular/angular/commit/827c3c15f40d1ac8106e2c26a0bafb1bcded4a18
#6…https://github.com/angular/angular/pull/63292
827c3c1https://github.com/angular/angular/commit/827c3c15f40d1ac8106e2c26a0bafb1bcded4a18
microsofthttps://github.com/microsoft
on Jan 7, 2026https://github.com/microsoft/TypeScript/issues/61369#event-21905532662
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/61369
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/61369
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.