Title: Manually constructed nullish coalescing + OR AST is missing parentheses when printed · Issue #62307 · microsoft/TypeScript · GitHub
Open Graph Title: Manually constructed nullish coalescing + OR AST is missing parentheses when printed · Issue #62307 · microsoft/TypeScript
X Title: Manually constructed nullish coalescing + OR AST is missing parentheses when printed · Issue #62307 · microsoft/TypeScript
Description: 🔎 Search Terms nullish coalescing boolean operation parenthesis 🕗 Version & Regression Information This changed between versions 5.8 and 5.9 Was probably changed by #61372 ⏯ Playground Link https://stackblitz.com/edit/vitejs-vite-a11yrnd...
Open Graph Description: 🔎 Search Terms nullish coalescing boolean operation parenthesis 🕗 Version & Regression Information This changed between versions 5.8 and 5.9 Was probably changed by #61372 ⏯ Playground Link https:/...
X Description: 🔎 Search Terms nullish coalescing boolean operation parenthesis 🕗 Version & Regression Information This changed between versions 5.8 and 5.9 Was probably changed by #61372 ⏯ Playground Link htt...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/62307
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Manually constructed nullish coalescing + OR AST is missing parentheses when printed","articleBody":"### 🔎 Search Terms\n\n* nullish coalescing\n* boolean operation\n* parenthesis\n\n### 🕗 Version & Regression Information\n\n- This changed between versions 5.8 and 5.9\n- Was probably changed by #61372\n\n### ⏯ Playground Link\n\nhttps://stackblitz.com/edit/vitejs-vite-a11yrnds?file=package.json,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 nullishOrNode = ts.factory.createExpressionStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier('a'),\n ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),\n ts.factory.createIdentifier('b')\n ),\n ts.factory.createToken(ts.SyntaxKind.BarBarToken),\n ts.factory.createIdentifier('d')\n )\n);\n\n// (a ? b : c) || d\nconst nullishOr = printer.printNode(\n ts.EmitHint.Unspecified,\n nullishOrNode,\n src\n);\n```\n\n\n### 🙁 Actual behavior\n\nTo output: `a ?? b || d;`\n\n### 🙂 Expected behavior\n\nTo output: `(a ?? b) || d;`\n\n### Additional information about the issue\n\nThis change as a breaking change by an Angular user after updating to TS 5.9 angular/angular#63287 ","author":{"url":"https://github.com/JeanMeche","@type":"Person","name":"JeanMeche"},"datePublished":"2025-08-20T17:37:20Z","url":"https://github.com/microsoft/TypeScript/issues/62307"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65eebb6c-48cf-06ae-f7e1-8fe70e21cae0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D97C:215B92:82EA2E:AFBDD3:6B00E14C |
| html-safe-nonce | d8218f3b7b8a764615d42ac44d1dd3bcd76cfca23c072dbe12fb6a368eaa23cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTdDOjIxNUI5Mjo4MkVBMkU6QUZCREQzOjZCMDBFMTRDIiwidmlzaXRvcl9pZCI6Ijc5NzA5MTIzMTMzMTYyNzA0MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a6bfb183089c90b91d08335a2679d21ea44ecf2dbe266c60b5944d9cb565e107 |
| hovercard-subject-tag | issue:3339007124 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/62307/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0598a4e307e83180a4996022c8f7420b1cfd519ff30d4415df8480f76135b33/microsoft/TypeScript/issues/62307 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0598a4e307e83180a4996022c8f7420b1cfd519ff30d4415df8480f76135b33/microsoft/TypeScript/issues/62307 |
| og:image:alt | 🔎 Search Terms nullish coalescing boolean operation parenthesis 🕗 Version & Regression Information This changed between versions 5.8 and 5.9 Was probably changed by #61372 ⏯ Playground Link https:/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JeanMeche |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width