@@ -199,3 +199,138 @@ let e3 = id(1) as const; // Error
199
199
>e3 : Symbol(e3, Decl(constAssertions.ts, 62, 3))
200
200
>id : Symbol(id, Decl(constAssertions.ts, 56, 34))
201
201
202
+ let t1 = 'foo' as const;
203
+ >t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3))
204
+
205
+ let t2 = 'bar' as const;
206
+ >t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3))
207
+
208
+ let t3 = `${t1}-${t2}` as const;
209
+ >t3 : Symbol(t3, Decl(constAssertions.ts, 66, 3))
210
+ >t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3))
211
+ >t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3))
212
+
213
+ let t4 = `${`(${t1})`}-${`(${t2})`}` as const;
214
+ >t4 : Symbol(t4, Decl(constAssertions.ts, 67, 3))
215
+ >t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3))
216
+ >t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3))
217
+
218
+ function ff1(x: 'foo' | 'bar', y: 1 | 2) {
219
+ >ff1 : Symbol(ff1, Decl(constAssertions.ts, 67, 46))
220
+ >x : Symbol(x, Decl(constAssertions.ts, 69, 13))
221
+ >y : Symbol(y, Decl(constAssertions.ts, 69, 30))
222
+
223
+ return `${x}-${y}` as const;
224
+ >x : Symbol(x, Decl(constAssertions.ts, 69, 13))
225
+ >y : Symbol(y, Decl(constAssertions.ts, 69, 30))
226
+ }
227
+
228
+ function ff2<T extends string, U extends string>(x: T, y: U) {
229
+ >ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1))
230
+ >T : Symbol(T, Decl(constAssertions.ts, 73, 13))
231
+ >U : Symbol(U, Decl(constAssertions.ts, 73, 30))
232
+ >x : Symbol(x, Decl(constAssertions.ts, 73, 49))
233
+ >T : Symbol(T, Decl(constAssertions.ts, 73, 13))
234
+ >y : Symbol(y, Decl(constAssertions.ts, 73, 54))
235
+ >U : Symbol(U, Decl(constAssertions.ts, 73, 30))
236
+
237
+ return `${x}-${y}` as const;
238
+ >x : Symbol(x, Decl(constAssertions.ts, 73, 49))
239
+ >y : Symbol(y, Decl(constAssertions.ts, 73, 54))
240
+ }
241
+
242
+ const ts1 = ff2('foo', 'bar');
243
+ >ts1 : Symbol(ts1, Decl(constAssertions.ts, 77, 5))
244
+ >ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1))
245
+
246
+ const ts2 = ff2('foo', !!true ? '0' : '1');
247
+ >ts2 : Symbol(ts2, Decl(constAssertions.ts, 78, 5))
248
+ >ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1))
249
+
250
+ const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right');
251
+ >ts3 : Symbol(ts3, Decl(constAssertions.ts, 79, 5))
252
+ >ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1))
253
+
254
+ function ff3(x: 'foo' | 'bar', y: object) {
255
+ >ff3 : Symbol(ff3, Decl(constAssertions.ts, 79, 70))
256
+ >x : Symbol(x, Decl(constAssertions.ts, 81, 13))
257
+ >y : Symbol(y, Decl(constAssertions.ts, 81, 30))
258
+
259
+ return `${x}${y}` as const;
260
+ >x : Symbol(x, Decl(constAssertions.ts, 81, 13))
261
+ >y : Symbol(y, Decl(constAssertions.ts, 81, 30))
262
+ }
263
+
264
+ type Action = "verify" | "write";
265
+ >Action : Symbol(Action, Decl(constAssertions.ts, 83, 1))
266
+
267
+ type ContentMatch = "match" | "nonMatch";
268
+ >ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33))
269
+
270
+ type Outcome = `${Action}_${ContentMatch}`;
271
+ >Outcome : Symbol(Outcome, Decl(constAssertions.ts, 86, 41))
272
+ >Action : Symbol(Action, Decl(constAssertions.ts, 83, 1))
273
+ >ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33))
274
+
275
+ function ff4(verify: boolean, contentMatches: boolean) {
276
+ >ff4 : Symbol(ff4, Decl(constAssertions.ts, 87, 43))
277
+ >verify : Symbol(verify, Decl(constAssertions.ts, 89, 13))
278
+ >contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 89, 29))
279
+
280
+ const action : Action = verify ? `verify` : `write`;
281
+ >action : Symbol(action, Decl(constAssertions.ts, 90, 9))
282
+ >Action : Symbol(Action, Decl(constAssertions.ts, 83, 1))
283
+ >verify : Symbol(verify, Decl(constAssertions.ts, 89, 13))
284
+
285
+ const contentMatch: ContentMatch = contentMatches ? `match` : `nonMatch`;
286
+ >contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 91, 9))
287
+ >ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33))
288
+ >contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 89, 29))
289
+
290
+ const outcome: Outcome = `${action}_${contentMatch}` as const;
291
+ >outcome : Symbol(outcome, Decl(constAssertions.ts, 92, 9))
292
+ >Outcome : Symbol(Outcome, Decl(constAssertions.ts, 86, 41))
293
+ >action : Symbol(action, Decl(constAssertions.ts, 90, 9))
294
+ >contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 91, 9))
295
+
296
+ return outcome;
297
+ >outcome : Symbol(outcome, Decl(constAssertions.ts, 92, 9))
298
+ }
299
+
300
+ function ff5(verify: boolean, contentMatches: boolean) {
301
+ >ff5 : Symbol(ff5, Decl(constAssertions.ts, 94, 1))
302
+ >verify : Symbol(verify, Decl(constAssertions.ts, 96, 13))
303
+ >contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 96, 29))
304
+
305
+ const action = verify ? `verify` : `write`;
306
+ >action : Symbol(action, Decl(constAssertions.ts, 97, 9))
307
+ >verify : Symbol(verify, Decl(constAssertions.ts, 96, 13))
308
+
309
+ const contentMatch = contentMatches ? `match` : `nonMatch`;
310
+ >contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 98, 9))
311
+ >contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 96, 29))
312
+
313
+ const outcome = `${action}_${contentMatch}` as const;
314
+ >outcome : Symbol(outcome, Decl(constAssertions.ts, 99, 9))
315
+ >action : Symbol(action, Decl(constAssertions.ts, 97, 9))
316
+ >contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 98, 9))
317
+
318
+ return outcome;
319
+ >outcome : Symbol(outcome, Decl(constAssertions.ts, 99, 9))
320
+ }
321
+
322
+ function accessorNames<S extends string>(propName: S) {
323
+ >accessorNames : Symbol(accessorNames, Decl(constAssertions.ts, 101, 1))
324
+ >S : Symbol(S, Decl(constAssertions.ts, 103, 23))
325
+ >propName : Symbol(propName, Decl(constAssertions.ts, 103, 41))
326
+ >S : Symbol(S, Decl(constAssertions.ts, 103, 23))
327
+
328
+ return [`get-${propName}`, `set-${propName}`] as const;
329
+ >propName : Symbol(propName, Decl(constAssertions.ts, 103, 41))
330
+ >propName : Symbol(propName, Decl(constAssertions.ts, 103, 41))
331
+ }
332
+
333
+ const ns1 = accessorNames('foo');
334
+ >ns1 : Symbol(ns1, Decl(constAssertions.ts, 107, 5))
335
+ >accessorNames : Symbol(accessorNames, Decl(constAssertions.ts, 101, 1))
336
+
0 commit comments