Skip to content

Incorrect handling of template literals + intersections #53427

Description

Bug Report

🔎 Search Terms

intersection template literals

🕗 Version & Regression Information

  • This changed between versions 5.0 and nightly

⏯ Playground Link

Playground Link

💻 Code

typeMaybeCat= `c${string}` & `${string}t`;typeMaybeScats= `s${MaybeCat}s`;declarevarx: MaybeScats;x="scats";// should be OKx="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.

Metadata

Metadata

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions