Skip to content

Fix TODO in psuedochecker's typeNodeCouldReferToUndefined - #65470

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/intersection-undefined
Open

Jake Bailey (jakebailey) wants to merge 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

This branch has not been deployed

No deployments
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: Not started

Development

Successfully merging this pull request may close these issues.

2 participants