Closed
Description
Bug Report
π Search Terms
branded, interpolation, 5.1.3
π Version & Regression Information
This changed between versions 5.0.4 and 5.1.3
β― Playground Link
Playground link with relevant code
π» Code
type S = `id_${string & {_brand: "ID"}}`;
// ^? type S = `id_${string & { _brand: "ID"; }}`
declare const id: string & {_brand: "ID"};
const s = `id_${id}` as const;
// ^? const s: `id_${string & { _brand: "ID"; }}`
π Actual behavior
The intersected brand is preserved during string interpolation for variables and types!
π Expected behavior
Pre 5.1.3, the intersected brand always got removed during string interpolation for variables and types.
This is part bug report and question. My question being in future versions, will this behavior be preserved? I wrote a clunky generic function and type to do this exact thing because I found it valuable, but I'd much rather rely on native behavior if this is going to stick around π
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment