@@ -405,3 +405,92 @@ declare function chain<F extends keyof Schema>(field: F | `${F}.${F}`): void;
405405chain("a");
406406>chain : Symbol(chain, Decl(templateLiteralTypes3.ts, 120, 42))
407407
408+ // Repro from #46125
409+
410+ function ff1<T extends string>(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) {
411+ >ff1 : Symbol(ff1, Decl(templateLiteralTypes3.ts, 124, 11))
412+ >T : Symbol(T, Decl(templateLiteralTypes3.ts, 128, 13))
413+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 31))
414+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 128, 50))
415+ >z : Symbol(z, Decl(templateLiteralTypes3.ts, 128, 70))
416+
417+ if (x === y) {
418+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 31))
419+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 128, 50))
420+
421+ x; // `foo-${string}`
422+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 31))
423+ }
424+ if (x === z) { // Error
425+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 31))
426+ >z : Symbol(z, Decl(templateLiteralTypes3.ts, 128, 70))
427+ }
428+ }
429+
430+ function ff2(x: string, y: `foo-${string}` | 'bar') {
431+ >ff2 : Symbol(ff2, Decl(templateLiteralTypes3.ts, 134, 1))
432+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 13))
433+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 136, 23))
434+
435+ if (x === y) {
436+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 13))
437+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 136, 23))
438+
439+ x; // `foo-${string}` | 'bar'
440+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 13))
441+ }
442+ }
443+
444+ function ff3(x: string, y: `foo-${string}`) {
445+ >ff3 : Symbol(ff3, Decl(templateLiteralTypes3.ts, 140, 1))
446+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 142, 13))
447+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 142, 23))
448+
449+ if (x === 'foo-test') {
450+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 142, 13))
451+
452+ x; // 'foo-test'
453+ >x : Symbol(x, Decl(templateLiteralTypes3.ts, 142, 13))
454+ }
455+ if (y === 'foo-test') {
456+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 142, 23))
457+
458+ y; // 'foo-test'
459+ >y : Symbol(y, Decl(templateLiteralTypes3.ts, 142, 23))
460+ }
461+ }
462+
463+ // Repro from #46045
464+
465+ export type Action =
466+ >Action : Symbol(Action, Decl(templateLiteralTypes3.ts, 149, 1))
467+
468+ | { type: `${string}_REQUEST` }
469+ >type : Symbol(type, Decl(templateLiteralTypes3.ts, 154, 7))
470+
471+ | { type: `${string}_SUCCESS`, response: string };
472+ >type : Symbol(type, Decl(templateLiteralTypes3.ts, 155, 7))
473+ >response : Symbol(response, Decl(templateLiteralTypes3.ts, 155, 34))
474+
475+ export function reducer(action: Action) {
476+ >reducer : Symbol(reducer, Decl(templateLiteralTypes3.ts, 155, 54))
477+ >action : Symbol(action, Decl(templateLiteralTypes3.ts, 157, 24))
478+ >Action : Symbol(Action, Decl(templateLiteralTypes3.ts, 149, 1))
479+
480+ if (action.type === 'FOO_SUCCESS') {
481+ >action.type : Symbol(type, Decl(templateLiteralTypes3.ts, 154, 7), Decl(templateLiteralTypes3.ts, 155, 7))
482+ >action : Symbol(action, Decl(templateLiteralTypes3.ts, 157, 24))
483+ >type : Symbol(type, Decl(templateLiteralTypes3.ts, 154, 7), Decl(templateLiteralTypes3.ts, 155, 7))
484+
485+ action.type;
486+ >action.type : Symbol(type, Decl(templateLiteralTypes3.ts, 155, 7))
487+ >action : Symbol(action, Decl(templateLiteralTypes3.ts, 157, 24))
488+ >type : Symbol(type, Decl(templateLiteralTypes3.ts, 155, 7))
489+
490+ action.response;
491+ >action.response : Symbol(response, Decl(templateLiteralTypes3.ts, 155, 34))
492+ >action : Symbol(action, Decl(templateLiteralTypes3.ts, 157, 24))
493+ >response : Symbol(response, Decl(templateLiteralTypes3.ts, 155, 34))
494+ }
495+ }
496+
0 commit comments