Skip to content

Characters count as both prefix and suffix of pattern literal #40772

@andrewbranch

Description

@andrewbranch

TypeScript Version: v4.1.0-dev20200925

Search Terms: pattern literal prefix suffix

Code

const s: `:${string}:` = ":";

Expected behavior:
Assignability error because the pattern `:${string}:` has two literal : characters, while ":" has only one.

Actual behavior:
No error

Playground Link

Related Issues: #40598

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions