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

Improve ternary type inference #15397

Closed
jeskew opened this issue Oct 24, 2024 · 0 comments · Fixed by #15399
Closed

Improve ternary type inference #15397

jeskew opened this issue Oct 24, 2024 · 0 comments · Fixed by #15399
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@jeskew
Copy link
Member

jeskew commented Oct 24, 2024

Ternary expressions are always typed as the union of the type of the true branch expression and the type of the false branch expression. Two improvements could be made here:

  1. If the condition is known, only the type of the active branch's expression should be used.
  2. If the two branches have types that can be combined, they should be.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant