Skip to content

Properly reduce intersections of string literal and template literal types - #41162

Merged
Anders Hejlsberg (ahejlsberg) merged 3 commits into
masterfrom
fix41161
Oct 19, 2020
Merged

Properly reduce intersections of string literal and template literal types#41162
Anders Hejlsberg (ahejlsberg) merged 3 commits into
masterfrom
fix41161

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes #41161.

@weswigham Wesley Wigham (weswigham) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, this is fine, but the reduce operation has the potential to be very expensive on large input sets. Are we sure there's not a way re can rejigger how we read the cache to keep the operation cached (even when the final result is never)?

@ahejlsberg

Copy link
Copy Markdown
Member Author

Wesley Wigham (@weswigham) I think it's going to be quite rare to have large intersection input sets that contain both string literal types and template literal types so I'm not too worried about it. I think the common pattern here will be intersecting a large union of string literal types with a template literal type, but that'll normalize to a large union of little intersections.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intersections with template literal types not correctly reduced

3 participants