Skip to content

Incorrect handling of template literals + intersectionsΒ #53427

Closed
@jakebailey

Description

@jakebailey

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.

Metadata

Metadata

Assignees

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