Cannot define a matching template literal type to a defined template literal ยท Issue #43143 ยท microsoft/TypeScript (original) (raw)

Bug Report

๐Ÿ”Ž Search Terms

string, template, literal, type

๐Ÿ•— Version & Regression Information

This is the behavior in every version I tried, including Nightly

Playground link with relevant code

๐Ÿ’ป Code

function getCardTitle(title: string): test-${string} { return test-${title}; }

๐Ÿ™ Actual behavior

TS infers the type string for the returned string, instead of the templated type.

๐Ÿ™‚ Expected behavior

No error!