|
| 1 | +//// [tests/cases/compiler/brandedLiteralRevert2.ts] //// |
| 2 | + |
| 3 | +=== brandedLiteralRevert2.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/60990 |
| 5 | + |
| 6 | +type Brand1 = number & 1 & { |
| 7 | +>Brand1 : Symbol(Brand1, Decl(brandedLiteralRevert2.ts, 0, 0)) |
| 8 | + |
| 9 | + test: "TEST" |
| 10 | +>test : Symbol(test, Decl(brandedLiteralRevert2.ts, 2, 28)) |
| 11 | +} |
| 12 | + |
| 13 | +type Brand2 = "a" & { |
| 14 | +>Brand2 : Symbol(Brand2, Decl(brandedLiteralRevert2.ts, 4, 1)) |
| 15 | + |
| 16 | + test: "TEST1" |
| 17 | +>test : Symbol(test, Decl(brandedLiteralRevert2.ts, 6, 21)) |
| 18 | +} |
| 19 | + |
| 20 | +let brandN1: Brand1 = 1 as Brand1 |
| 21 | +>brandN1 : Symbol(brandN1, Decl(brandedLiteralRevert2.ts, 10, 3)) |
| 22 | +>Brand1 : Symbol(Brand1, Decl(brandedLiteralRevert2.ts, 0, 0)) |
| 23 | +>Brand1 : Symbol(Brand1, Decl(brandedLiteralRevert2.ts, 0, 0)) |
| 24 | + |
| 25 | +let brandN2: Brand2 = "a" as Brand2 |
| 26 | +>brandN2 : Symbol(brandN2, Decl(brandedLiteralRevert2.ts, 11, 3)) |
| 27 | +>Brand2 : Symbol(Brand2, Decl(brandedLiteralRevert2.ts, 4, 1)) |
| 28 | +>Brand2 : Symbol(Brand2, Decl(brandedLiteralRevert2.ts, 4, 1)) |
| 29 | + |
| 30 | +let brandM11: `${number}` = `${brandN1}` // ok |
| 31 | +>brandM11 : Symbol(brandM11, Decl(brandedLiteralRevert2.ts, 13, 3)) |
| 32 | +>brandN1 : Symbol(brandN1, Decl(brandedLiteralRevert2.ts, 10, 3)) |
| 33 | + |
| 34 | +let brandM12: "1" = `${brandN1}` // ok |
| 35 | +>brandM12 : Symbol(brandM12, Decl(brandedLiteralRevert2.ts, 14, 3)) |
| 36 | +>brandN1 : Symbol(brandN1, Decl(brandedLiteralRevert2.ts, 10, 3)) |
| 37 | + |
| 38 | +let brandM13: `${1}` = `${brandN1}` // ok |
| 39 | +>brandM13 : Symbol(brandM13, Decl(brandedLiteralRevert2.ts, 15, 3)) |
| 40 | +>brandN1 : Symbol(brandN1, Decl(brandedLiteralRevert2.ts, 10, 3)) |
| 41 | + |
| 42 | +let brandM21: "a" = `${brandN2}` // ok |
| 43 | +>brandM21 : Symbol(brandM21, Decl(brandedLiteralRevert2.ts, 17, 3)) |
| 44 | +>brandN2 : Symbol(brandN2, Decl(brandedLiteralRevert2.ts, 11, 3)) |
| 45 | + |
| 46 | +let brandM22: "1a" = `${brandN1}${brandN2}` // ok |
| 47 | +>brandM22 : Symbol(brandM22, Decl(brandedLiteralRevert2.ts, 18, 3)) |
| 48 | +>brandN1 : Symbol(brandN1, Decl(brandedLiteralRevert2.ts, 10, 3)) |
| 49 | +>brandN2 : Symbol(brandN2, Decl(brandedLiteralRevert2.ts, 11, 3)) |
| 50 | + |
0 commit comments