Skip to content

Conversation

@fisker
Copy link
Member

@fisker fisker commented Dec 1, 2025

Description

It's dead code because we always unwrap single types.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 1, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/prettier/prettier/@prettier/[email protected]
yarn add https://pkg.pr.new/prettier/prettier/@prettier/[email protected]
yarn add https://pkg.pr.new/prettier/[email protected]

commit: 698988b

@netlify
Copy link

netlify bot commented Dec 1, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit 698988b
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/692de031c39aba000857ca81
😎 Deploy Preview https://deploy-preview-18396--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

case "TSIntersectionType":
if (
(isUnionType(parent) || isIntersectionType(parent)) &&
parent.types.length > 1 &&
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

union/intersection always have multiple types.

if (
(isUnionType(parent) || isIntersectionType(parent)) &&
parent.types.length > 1 &&
(!node.types || node.types.length > 1)
Copy link
Member Author

@fisker fisker Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!node.type matches node above that fallthrough, node.types.length > 1 matches union/intersection, so it's always true.

@fisker fisker merged commit fe49434 into prettier:main Dec 1, 2025
35 checks passed
@fisker fisker deleted the union-type-length branch December 1, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant