|
1 | 1 | tests/cases/conformance/types/literal/templateLiteralTypes2.ts(23,11): error TS2322: Type 'string' is not assignable to type '`abc${string}`'. |
2 | 2 | tests/cases/conformance/types/literal/templateLiteralTypes2.ts(29,11): error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}`'. |
3 | 3 | tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}` | `baz${string}`'. |
4 | | -tests/cases/conformance/types/literal/templateLiteralTypes2.ts(67,9): error TS2322: Type '`foo${number}`' is not assignable to type 'String'. |
5 | | -tests/cases/conformance/types/literal/templateLiteralTypes2.ts(68,9): error TS2322: Type '`foo${number}`' is not assignable to type 'Object'. |
6 | | -tests/cases/conformance/types/literal/templateLiteralTypes2.ts(69,9): error TS2322: Type '`foo${number}`' is not assignable to type '{}'. |
7 | | -tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS2322: Type '`foo${number}`' is not assignable to type '{ length: number; }'. |
8 | 4 |
|
9 | 5 |
|
10 | | -==== tests/cases/conformance/types/literal/templateLiteralTypes2.ts (7 errors) ==== |
| 6 | +==== tests/cases/conformance/types/literal/templateLiteralTypes2.ts (3 errors) ==== |
11 | 7 | function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t: T) { |
12 | 8 | const c1 = `abc${s}`; // `abc${string}` |
13 | 9 | const c2 = `abc${n}`; // `abc${number}` |
@@ -81,17 +77,9 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS23 |
81 | 77 | function ft14(t: `foo${number}`) { |
82 | 78 | let x1: string = t; |
83 | 79 | let x2: String = t; |
84 | | - ~~ |
85 | | -!!! error TS2322: Type '`foo${number}`' is not assignable to type 'String'. |
86 | 80 | let x3: Object = t; |
87 | | - ~~ |
88 | | -!!! error TS2322: Type '`foo${number}`' is not assignable to type 'Object'. |
89 | 81 | let x4: {} = t; |
90 | | - ~~ |
91 | | -!!! error TS2322: Type '`foo${number}`' is not assignable to type '{}'. |
92 | 82 | let x6: { length: number } = t; |
93 | | - ~~ |
94 | | -!!! error TS2322: Type '`foo${number}`' is not assignable to type '{ length: number; }'. |
95 | 83 | } |
96 | 84 |
|
97 | 85 | declare function g1<T>(x: T): T; |
@@ -134,4 +122,10 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS23 |
134 | 122 | function getCardTitle(title: string): `test-${string}` { |
135 | 123 | return `test-${title}`; |
136 | 124 | } |
| 125 | + |
| 126 | + // Repro from #43424 |
| 127 | + |
| 128 | + const interpolatedStyle = { rotate: 12 }; |
| 129 | + function C2(transform: "-moz-initial" | (string & {})) { return 12; } |
| 130 | + C2(`rotate(${interpolatedStyle.rotate}dig)`); |
137 | 131 |
|
0 commit comments