@@ -574,3 +574,55 @@ class SqlTable<T> {
574
574
}
575
575
}
576
576
577
+ // Repro from #46495
578
+
579
+ interface Button {
580
+ >Button : Symbol(Button, Decl(controlFlowGenericTypes.ts, 190, 1))
581
+
582
+ type: "button";
583
+ >type : Symbol(Button.type, Decl(controlFlowGenericTypes.ts, 194, 18))
584
+
585
+ text: string;
586
+ >text : Symbol(Button.text, Decl(controlFlowGenericTypes.ts, 195, 19))
587
+ }
588
+
589
+ interface Checkbox {
590
+ >Checkbox : Symbol(Checkbox, Decl(controlFlowGenericTypes.ts, 197, 1))
591
+
592
+ type: "checkbox";
593
+ >type : Symbol(Checkbox.type, Decl(controlFlowGenericTypes.ts, 199, 20))
594
+
595
+ isChecked: boolean;
596
+ >isChecked : Symbol(Checkbox.isChecked, Decl(controlFlowGenericTypes.ts, 200, 21))
597
+ }
598
+
599
+ type Control = Button | Checkbox;
600
+ >Control : Symbol(Control, Decl(controlFlowGenericTypes.ts, 202, 1))
601
+ >Button : Symbol(Button, Decl(controlFlowGenericTypes.ts, 190, 1))
602
+ >Checkbox : Symbol(Checkbox, Decl(controlFlowGenericTypes.ts, 197, 1))
603
+
604
+ function update<T extends Control, K extends keyof T>(control : T | undefined, key: K, value: T[K]): void {
605
+ >update : Symbol(update, Decl(controlFlowGenericTypes.ts, 204, 33))
606
+ >T : Symbol(T, Decl(controlFlowGenericTypes.ts, 206, 16))
607
+ >Control : Symbol(Control, Decl(controlFlowGenericTypes.ts, 202, 1))
608
+ >K : Symbol(K, Decl(controlFlowGenericTypes.ts, 206, 34))
609
+ >T : Symbol(T, Decl(controlFlowGenericTypes.ts, 206, 16))
610
+ >control : Symbol(control, Decl(controlFlowGenericTypes.ts, 206, 54))
611
+ >T : Symbol(T, Decl(controlFlowGenericTypes.ts, 206, 16))
612
+ >key : Symbol(key, Decl(controlFlowGenericTypes.ts, 206, 78))
613
+ >K : Symbol(K, Decl(controlFlowGenericTypes.ts, 206, 34))
614
+ >value : Symbol(value, Decl(controlFlowGenericTypes.ts, 206, 86))
615
+ >T : Symbol(T, Decl(controlFlowGenericTypes.ts, 206, 16))
616
+ >K : Symbol(K, Decl(controlFlowGenericTypes.ts, 206, 34))
617
+
618
+ if (control !== undefined) {
619
+ >control : Symbol(control, Decl(controlFlowGenericTypes.ts, 206, 54))
620
+ >undefined : Symbol(undefined)
621
+
622
+ control[key] = value;
623
+ >control : Symbol(control, Decl(controlFlowGenericTypes.ts, 206, 54))
624
+ >key : Symbol(key, Decl(controlFlowGenericTypes.ts, 206, 78))
625
+ >value : Symbol(value, Decl(controlFlowGenericTypes.ts, 206, 86))
626
+ }
627
+ }
628
+
0 commit comments