Repository navigation
Fix TODO in psuedochecker's typeNodeCouldReferToUndefined - #65470
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
🟢 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, andnever. - 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was a TODO. Now we have a test for it.