Skip to content

Fix quick fix for isolatedDeclarations to keep trailing unknown in generics #61227

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

Merged

Conversation

blickly
Copy link
Contributor

@blickly blickly commented Feb 19, 2025

Update typeToMinimizedReferenceType helper to avoid dropping trailing unknown inside generics. This avoids a bug where non-optional trailing unknown types were incorrectly dropped.

Fixes #61208

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 19, 2025
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Would a better fix to just be to check to see how many required type args are needed, and then not cross that threshold? I would think we have a way to access that information.

…aints

Also, update the test that this improves.
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Yeah, this looks better!

@blickly
Copy link
Contributor Author

blickly commented Feb 20, 2025

Great point! I misremembered what the constraints were when I assumed that we couldn't look up which type arguments were required or not. AFAICT, having a constraint corresponds to being optional, which seems like a more direct way to check than I was doing before.

@jakebailey jakebailey merged commit 3f416e0 into microsoft:main Feb 20, 2025
32 checks passed
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[isolatedDecalaration] Quick fix for isolatedDeclarations drops trailing unknown in generics instantiation
3 participants