Skip to content
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

Incorrect handling of template literals + intersections #53427

Closed
jakebailey opened this issue Mar 21, 2023 · 1 comment
Closed

Incorrect handling of template literals + intersections #53427

jakebailey opened this issue Mar 21, 2023 · 1 comment
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@jakebailey
Copy link
Member

Bug Report

πŸ”Ž Search Terms

intersection template literals

πŸ•— Version & Regression Information

  • This changed between versions 5.0 and nightly

⏯ Playground Link

Playground Link

πŸ’» Code

type MaybeCat = `c${string}` & `${string}t`;
type MaybeScats = `s${MaybeCat}s`;

declare var x: MaybeScats;

x = "scats"; // should be OK
x = "scas"; // should error

πŸ™ Actual behavior

In 5.0, neither error, even though the second one should.

In nightly, after #52836, both error.

πŸ™‚ Expected behavior

First one is okay, second is an error.

Noted in: #53406 (review)

Unsure if this is a regression per-se; neither behavior is really right, I just managed to change it and expose what I believe is a new bug to do with how we handle template literals.

@jakebailey jakebailey self-assigned this Mar 21, 2023
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 22, 2023
@ahejlsberg
Copy link
Member

Fixed by #54188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

3 participants