File: templateLiteralTypesPatterns.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (376 lines) | stat: -rw-r--r-- 22,801 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(7,7): error TS2322: Type '"no slash"' is not assignable to type '`/${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(14,10): error TS2345: Argument of type '"example.com/noprotocol"' is not assignable to parameter of type '`http://${string}` | `https://${string}` | `ftp://${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(16,10): error TS2345: Argument of type '"gopher://example.com/protocol"' is not assignable to parameter of type '`http://${string}` | `https://${string}` | `ftp://${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(26,7): error TS2345: Argument of type '"other"' is not assignable to parameter of type '"false" | "true"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(35,11): error TS2345: Argument of type '"0"' is not assignable to parameter of type '"undefined" | "null"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(36,11): error TS2345: Argument of type '"false"' is not assignable to parameter of type '"undefined" | "null"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(37,11): error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '"undefined" | "null"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(38,11): error TS2345: Argument of type '""' is not assignable to parameter of type '"undefined" | "null"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(39,11): error TS2345: Argument of type '"other"' is not assignable to parameter of type '"undefined" | "null"'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(60,9): error TS2345: Argument of type '"?"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(61,9): error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(62,9): error TS2345: Argument of type '"Infinity"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(63,9): error TS2345: Argument of type '"+Infinity"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(64,9): error TS2345: Argument of type '"-Infinity"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(65,9): error TS2345: Argument of type '"1_000"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(68,9): error TS2345: Argument of type '"a10"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(69,9): error TS2345: Argument of type '"10a"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(72,9): error TS2345: Argument of type '"- 1"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(73,9): error TS2345: Argument of type '"-/**/1"' is not assignable to parameter of type '`${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(85,9): error TS2345: Argument of type '"1e21"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(86,9): error TS2345: Argument of type '"1E21"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(87,9): error TS2345: Argument of type '"1e-21"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(88,9): error TS2345: Argument of type '"1E-21"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(91,9): error TS2345: Argument of type '"1.0"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(92,9): error TS2345: Argument of type '"1.1"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(93,9): error TS2345: Argument of type '"-1.1"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(94,9): error TS2345: Argument of type '"-1.1e-10"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(95,9): error TS2345: Argument of type '"-1.1E-10"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(96,9): error TS2345: Argument of type '"1.1e-10"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(99,9): error TS2345: Argument of type '"?"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(100,9): error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(101,9): error TS2345: Argument of type '"Infinity"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(102,9): error TS2345: Argument of type '"+Infinity"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(103,9): error TS2345: Argument of type '"-Infinity"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(104,9): error TS2345: Argument of type '"1_000"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(107,9): error TS2345: Argument of type '"- 1"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(108,9): error TS2345: Argument of type '"-/**/1"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(111,9): error TS2345: Argument of type '"a10n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(112,9): error TS2345: Argument of type '"10an"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(115,9): error TS2345: Argument of type '"1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(116,9): error TS2345: Argument of type '"-1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(117,9): error TS2345: Argument of type '"0n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(118,9): error TS2345: Argument of type '"0b1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(119,9): error TS2345: Argument of type '"0x1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(120,9): error TS2345: Argument of type '"0o1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(121,9): error TS2345: Argument of type '"1e21n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(122,9): error TS2345: Argument of type '"1E21n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(123,9): error TS2345: Argument of type '"1e-21n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(124,9): error TS2345: Argument of type '"1E-21n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(125,9): error TS2345: Argument of type '"1.1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(126,9): error TS2345: Argument of type '"-1.1n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(127,9): error TS2345: Argument of type '"-1.1e-10n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(128,9): error TS2345: Argument of type '"-1.1E-10n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(129,9): error TS2345: Argument of type '"1.1e-10n"' is not assignable to parameter of type '`${bigint}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(140,1): error TS2322: Type '`a${string}`' is not assignable to type '`a${number}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(141,1): error TS2322: Type '"bno"' is not assignable to type '`a${any}`'.
tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts(160,7): error TS2322: Type '"anything"' is not assignable to type '`${number} ${number}`'.


==== tests/cases/conformance/types/literal/templateLiteralTypesPatterns.ts (57 errors) ====
    type RequiresLeadingSlash = `/${string}`;
    
    // ok
    const a: RequiresLeadingSlash = "/bin";
    
    // not ok
    const b: RequiresLeadingSlash = "no slash";
          ~
!!! error TS2322: Type '"no slash"' is not assignable to type '`/${string}`'.
    
    type Protocol<T extends string, U extends string> = `${T}://${U}`;
    function download(hostSpec: Protocol<"http" | "https" | "ftp", string>) { }
    // ok, has protocol
    download("http://example.com/protocol");
    // issues error - no protocol
    download("example.com/noprotocol");
             ~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"example.com/noprotocol"' is not assignable to parameter of type '`http://${string}` | `https://${string}` | `ftp://${string}`'.
    // issues error, incorrect protocol
    download("gopher://example.com/protocol");
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"gopher://example.com/protocol"' is not assignable to parameter of type '`http://${string}` | `https://${string}` | `ftp://${string}`'.
    
    const q: RequiresLeadingSlash extends string ? true : false = true;
    
    declare function bools(x: `${boolean}`): void;
    // ok
    bools("true");
    bools("false");
    
    // not ok
    bools("other");
          ~~~~~~~
!!! error TS2345: Argument of type '"other"' is not assignable to parameter of type '"false" | "true"'.
    
    type Pat<T extends string | null | undefined> = `${T}`
    declare function nullishes(x: Pat<null | undefined>): void;
    // ok
    nullishes("null");
    nullishes("undefined");
    
    // not ok
    nullishes("0");
              ~~~
!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type '"undefined" | "null"'.
    nullishes("false");
              ~~~~~~~
!!! error TS2345: Argument of type '"false"' is not assignable to parameter of type '"undefined" | "null"'.
    nullishes("NaN");
              ~~~~~
!!! error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '"undefined" | "null"'.
    nullishes("");
              ~~
!!! error TS2345: Argument of type '""' is not assignable to parameter of type '"undefined" | "null"'.
    nullishes("other");
              ~~~~~~~
!!! error TS2345: Argument of type '"other"' is not assignable to parameter of type '"undefined" | "null"'.
    
    declare function numbers(x: `${number}`): void;
    // the following should work
    numbers("1");
    numbers("-1");
    numbers("0");
    numbers("0b1");
    numbers("0x1");
    numbers("0o1");
    numbers("1e21");
    numbers("1E21");
    numbers("1e-21");
    numbers("1E-21");
    numbers("1.1");
    numbers("-1.1");
    numbers("-1.1e-10");
    numbers("-1.1E-10");
    numbers("1.1e-10");
    
    // the following should be errors since they're not numbers
    numbers("?");
            ~~~
!!! error TS2345: Argument of type '"?"' is not assignable to parameter of type '`${number}`'.
    numbers("NaN");
            ~~~~~
!!! error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '`${number}`'.
    numbers("Infinity");
            ~~~~~~~~~~
!!! error TS2345: Argument of type '"Infinity"' is not assignable to parameter of type '`${number}`'.
    numbers("+Infinity");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"+Infinity"' is not assignable to parameter of type '`${number}`'.
    numbers("-Infinity");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"-Infinity"' is not assignable to parameter of type '`${number}`'.
    numbers("1_000");
            ~~~~~~~
!!! error TS2345: Argument of type '"1_000"' is not assignable to parameter of type '`${number}`'.
    
    // the following should be errors since they don't match the pattern
    numbers("a10");
            ~~~~~
!!! error TS2345: Argument of type '"a10"' is not assignable to parameter of type '`${number}`'.
    numbers("10a");
            ~~~~~
!!! error TS2345: Argument of type '"10a"' is not assignable to parameter of type '`${number}`'.
    
    // whitespace and comments aren't part of numbers
    numbers("- 1");
            ~~~~~
!!! error TS2345: Argument of type '"- 1"' is not assignable to parameter of type '`${number}`'.
    numbers("-/**/1");
            ~~~~~~~~
!!! error TS2345: Argument of type '"-/**/1"' is not assignable to parameter of type '`${number}`'.
    
    declare function bigints(x: `${bigint}`): void;
    // the following should work
    bigints("1");
    bigints("-1");
    bigints("0");
    bigints("0b1");
    bigints("0x1");
    bigints("0o1");
    
    // bigints do not allow scientific notation in their parsing/scanning, so these are all errors
    bigints("1e21");
            ~~~~~~
!!! error TS2345: Argument of type '"1e21"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1E21");
            ~~~~~~
!!! error TS2345: Argument of type '"1E21"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1e-21");
            ~~~~~~~
!!! error TS2345: Argument of type '"1e-21"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1E-21");
            ~~~~~~~
!!! error TS2345: Argument of type '"1E-21"' is not assignable to parameter of type '`${bigint}`'.
    
    // these are all errors because they're not big_int_s
    bigints("1.0");
            ~~~~~
!!! error TS2345: Argument of type '"1.0"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1.1");
            ~~~~~
!!! error TS2345: Argument of type '"1.1"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1");
            ~~~~~~
!!! error TS2345: Argument of type '"-1.1"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1e-10");
            ~~~~~~~~~~
!!! error TS2345: Argument of type '"-1.1e-10"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1E-10");
            ~~~~~~~~~~
!!! error TS2345: Argument of type '"-1.1E-10"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1.1e-10");
            ~~~~~~~~~
!!! error TS2345: Argument of type '"1.1e-10"' is not assignable to parameter of type '`${bigint}`'.
    
    // the following should be errors since they're not numbers
    bigints("?");
            ~~~
!!! error TS2345: Argument of type '"?"' is not assignable to parameter of type '`${bigint}`'.
    bigints("NaN");
            ~~~~~
!!! error TS2345: Argument of type '"NaN"' is not assignable to parameter of type '`${bigint}`'.
    bigints("Infinity");
            ~~~~~~~~~~
!!! error TS2345: Argument of type '"Infinity"' is not assignable to parameter of type '`${bigint}`'.
    bigints("+Infinity");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"+Infinity"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-Infinity");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"-Infinity"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1_000");
            ~~~~~~~
!!! error TS2345: Argument of type '"1_000"' is not assignable to parameter of type '`${bigint}`'.
    
    // whitespace and comments aren't part of numbers
    bigints("- 1");
            ~~~~~
!!! error TS2345: Argument of type '"- 1"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-/**/1");
            ~~~~~~~~
!!! error TS2345: Argument of type '"-/**/1"' is not assignable to parameter of type '`${bigint}`'.
    
    // the following should be errors since they don't match the pattern
    bigints("a10n");
            ~~~~~~
!!! error TS2345: Argument of type '"a10n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("10an");
            ~~~~~~
!!! error TS2345: Argument of type '"10an"' is not assignable to parameter of type '`${bigint}`'.
    
    // the following should all be errors because the `BigInt` constructor (and thus bigint parsing) doesn't take the trailing `n` used in literals
    bigints("1n");
            ~~~~
!!! error TS2345: Argument of type '"1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1n");
            ~~~~~
!!! error TS2345: Argument of type '"-1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("0n");
            ~~~~
!!! error TS2345: Argument of type '"0n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("0b1n");
            ~~~~~~
!!! error TS2345: Argument of type '"0b1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("0x1n");
            ~~~~~~
!!! error TS2345: Argument of type '"0x1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("0o1n");
            ~~~~~~
!!! error TS2345: Argument of type '"0o1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1e21n");
            ~~~~~~~
!!! error TS2345: Argument of type '"1e21n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1E21n");
            ~~~~~~~
!!! error TS2345: Argument of type '"1E21n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1e-21n");
            ~~~~~~~~
!!! error TS2345: Argument of type '"1e-21n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1E-21n");
            ~~~~~~~~
!!! error TS2345: Argument of type '"1E-21n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1.1n");
            ~~~~~~
!!! error TS2345: Argument of type '"1.1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1n");
            ~~~~~~~
!!! error TS2345: Argument of type '"-1.1n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1e-10n");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"-1.1e-10n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("-1.1E-10n");
            ~~~~~~~~~~~
!!! error TS2345: Argument of type '"-1.1E-10n"' is not assignable to parameter of type '`${bigint}`'.
    bigints("1.1e-10n");
            ~~~~~~~~~~
!!! error TS2345: Argument of type '"1.1e-10n"' is not assignable to parameter of type '`${bigint}`'.
    
    type AStr = `a${string}`;
    type ANum = `a${number}`;
    type AAny = `a${any}`;
    
    declare var str: AStr;
    declare var num: ANum;
    declare var anyish: AAny;
    
    // not ok
    num = str;
    ~~~
!!! error TS2322: Type '`a${string}`' is not assignable to type '`a${number}`'.
    anyish = `bno`
    ~~~~~~
!!! error TS2322: Type '"bno"' is not assignable to type '`a${any}`'.
    
    // ok
    str = num;
    anyish = str;
    str = anyish;
    anyish = num;
    num = anyish;
    anyish = `aok`
    
    
    // Validates variance isn't measured as strictly covariant
    type AGen<T extends string | number> = {field: `a${T}`};
    const shouldWork1: AGen<string> = null as any as AGen<"yes">;
    const shouldWork2: AGen<string> = null as any as AGen<number>;
    
    // validates concatenation of patterns
    type A = `${number}`;
    type B = `${A} ${A}`;
    const exampleBad: B = "anything"; // fails
          ~~~~~~~~~~
!!! error TS2322: Type '"anything"' is not assignable to type '`${number} ${number}`'.
    const exampleGood: B = "1 2"; // ok
    
    // Repro from #41161
    
    var aa: '0';
    var aa: '0' & `${number}`;
    
    // Remove string literals from unions with matching template literals
    
    let t1: `foo${string}` | 'foo1' | '1foo';  // `foo${string}` | '1foo'
    let t2: `foo1` | '1foo' | 'foofoo' | `foo${string}` | 'foox' | 'xfoo';  // `foo${string}` | '1foo' | 'xfoo'
    let t3: `foo1` | '1foo' | 'foofoo' | `foo${string}` | 'foox' | 'xfoo' | `${number}foo`;  // `foo${string}` | xfoo' | `${number}foo`
    
    var bb: `${number}`;
    var bb: `${number}` | '0';
    
    // Normalize `${string}` to just string
    
    type T2S<A extends string, B extends string> = `${A}${B}`;
    
    type S10 = `${string}`;  // string
    type S11 = `${string}${string}${string}`;  // string
    type S12 = T2S<string, string>;  // string
    
    function ff1(x: `${string}-${string}`) {
        let s1 = x && 42;  // number
        let s2 = x || 42;  // `${string}-${string}`
    }
    
    // Repro from #41651
    
    export type Id<TA, TId extends string = string> = `${TId}-${TId}`;
    
    export class AA {}
    
    export abstract class BB {
        abstract get(id: Id<AA>): void;
        update(id: Id<AA>): void {
            this.get(id!);
        }
    }