Skip to content

Fix TODO in psuedochecker's typeNodeCouldReferToUndefined - #65470

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/intersection-undefined
Nov 13, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/intersection-undefined

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This was a TODO. Now we have a test for it.

A union member that includes undefined does not make an intersection
nullable when another member excludes it. Treating the intersection as
a union prevented defaulted parameters from acquiring explicit undefined
and caused isolated declaration emit to reject otherwise inferable
types.

Use a conjunction for intersection members while retaining conservative
handling of references. Cover both member orders, undefined-containing
intersections, any, unknown, never, and aliases in declaration
baselines.
Copilot AI balanced review requested due to automatic review settings November 13, 2026 04:45
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 13, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the intersection-handling fix for isolated declaration emit.

No open issues 🎉

What changed in this PR

Fixes intersection handling in the native compiler’s pseudochecker so isolated declaration emit adds undefined when needed for defaulted parameters.

Changes:

  • Requires every intersection member to potentially include undefined, replacing the previous “any member” check.
  • Adds regression cases covering member order, aliases, and any, unknown, and never.
  • Updates the corresponding compiler baselines.
File Description
tsc/​testdata/​tests/​cases/​compiler/​isolatedDeclarationsAddUndefined.ts Adds intersection regression cases.
tsc/​testdata/​baselines/​reference/​compiler/​isolatedDeclarationsAddUndefined.types Records expected parameter types.
tsc/​testdata/​baselines/​reference/​compiler/​isolatedDeclarationsAddUndefined.symbols Records symbols for the new cases.
tsc/​testdata/​baselines/​reference/​compiler/​isolatedDeclarationsAddUndefined.js Records JavaScript and declaration output.
tsc/​testdata/​baselines/​reference/​compiler/​isolatedDeclarationsAddUndefined.errors.txt Records no diagnostics for the new cases.
tsc/​internal/​pseudochecker/​lookup.go Changes intersection checking from core.Some to core.Every.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Nov 13, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Nov 13, 2026
Merged via the queue into microsoft:main with commit 9dcc382 Nov 13, 2026
34 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the compiler-fixes/intersection-undefined branch November 13, 2026 18:50
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants