ARTICLE AD BOX
given the following code:
type brandStringTest1 = `/test/${string}` & { __brand?: never } type brandStringTest2 = `${brandStringTest1}` const testTest_1 = (arg: brandStringTest1) => arg; const testRes1 = testTest_1('/test/abc'); const testTest_2 = (arg: brandStringTest2) => arg; const testRes2 = testTest_2('/test/abc'); // Argument of type '"/test/abc"' is not assignable to parameter of type '`${brandStringTest1}`'.Calling testTest_1 works without any errors, but calling testTest_2 with the same argument causes the shown error. The idea of the branded string is to allow for autocomplete when intersected with a different string which when intersected would otherwise be combined in to just /test/${string}, e.g. /test/my-test.
I could understand why either both calling testTest_1 and testTest_2 would fail or work, but I do not understand why the code only fails when wrapping the string in a Template Literal.
