-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Milestone
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 π
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug