|
| 1 | +=== tests/cases/compiler/specialIntersectionsInMappedTypes.ts === |
| 2 | +// Repro from #50683 |
| 3 | + |
| 4 | +type Alignment = (string & {}) | "left" | "center" | "right"; |
| 5 | +>Alignment : Symbol(Alignment, Decl(specialIntersectionsInMappedTypes.ts, 0, 0)) |
| 6 | + |
| 7 | +type Alignments = Record<Alignment, string>; |
| 8 | +>Alignments : Symbol(Alignments, Decl(specialIntersectionsInMappedTypes.ts, 2, 61)) |
| 9 | +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) |
| 10 | +>Alignment : Symbol(Alignment, Decl(specialIntersectionsInMappedTypes.ts, 0, 0)) |
| 11 | + |
| 12 | +const a: Alignments = { |
| 13 | +>a : Symbol(a, Decl(specialIntersectionsInMappedTypes.ts, 5, 5)) |
| 14 | +>Alignments : Symbol(Alignments, Decl(specialIntersectionsInMappedTypes.ts, 2, 61)) |
| 15 | + |
| 16 | + left: "align-left", |
| 17 | +>left : Symbol(left, Decl(specialIntersectionsInMappedTypes.ts, 5, 23)) |
| 18 | + |
| 19 | + center: "align-center", |
| 20 | +>center : Symbol(center, Decl(specialIntersectionsInMappedTypes.ts, 6, 23)) |
| 21 | + |
| 22 | + right: "align-right", |
| 23 | +>right : Symbol(right, Decl(specialIntersectionsInMappedTypes.ts, 7, 27)) |
| 24 | + |
| 25 | + other: "align-other", |
| 26 | +>other : Symbol(other, Decl(specialIntersectionsInMappedTypes.ts, 8, 25)) |
| 27 | + |
| 28 | +}; |
| 29 | + |
| 30 | +a.left.length; |
| 31 | +>a.left.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) |
| 32 | +>a.left : Symbol(left) |
| 33 | +>a : Symbol(a, Decl(specialIntersectionsInMappedTypes.ts, 5, 5)) |
| 34 | +>left : Symbol(left) |
| 35 | +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) |
| 36 | + |
| 37 | +a.other.length; // Error expected here |
| 38 | +>a.other.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) |
| 39 | +>a : Symbol(a, Decl(specialIntersectionsInMappedTypes.ts, 5, 5)) |
| 40 | +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) |
| 41 | + |
0 commit comments