@@ -626,84 +626,242 @@ function f40(c: C) {
626
626
>"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 167, 24))
627
627
}
628
628
629
+ function f50<T>(k: keyof T, s: string, n: number) {
630
+ >f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 180, 1))
631
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13))
632
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16))
633
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13))
634
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27))
635
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38))
636
+
637
+ const x1 = s as keyof T;
638
+ >x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 183, 9))
639
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27))
640
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13))
641
+
642
+ const x2 = n as keyof T;
643
+ >x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 184, 9))
644
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38))
645
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13))
646
+
647
+ const x3 = k as string;
648
+ >x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 185, 9))
649
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16))
650
+
651
+ const x4 = k as number;
652
+ >x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 186, 9))
653
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16))
654
+
655
+ const x5 = k as string | number;
656
+ >x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 187, 9))
657
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16))
658
+ }
659
+
660
+ function f51<T, K extends keyof T>(k: K, s: string, n: number) {
661
+ >f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 188, 1))
662
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13))
663
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15))
664
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13))
665
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35))
666
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15))
667
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40))
668
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51))
669
+
670
+ const x1 = s as keyof T;
671
+ >x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 191, 9))
672
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40))
673
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13))
674
+
675
+ const x2 = n as keyof T;
676
+ >x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 192, 9))
677
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51))
678
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13))
679
+
680
+ const x3 = k as string;
681
+ >x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 193, 9))
682
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35))
683
+
684
+ const x4 = k as number;
685
+ >x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 194, 9))
686
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35))
687
+
688
+ const x5 = k as string | number;
689
+ >x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 195, 9))
690
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35))
691
+ }
692
+
693
+ function f52<T>(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) {
694
+ >f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 196, 1))
695
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13))
696
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16))
697
+ >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 198, 24))
698
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46))
699
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13))
700
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58))
701
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69))
702
+
703
+ const x1 = obj[s];
704
+ >x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 199, 9))
705
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16))
706
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58))
707
+
708
+ const x2 = obj[n];
709
+ >x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 200, 9))
710
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16))
711
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69))
712
+
713
+ const x3 = obj[k];
714
+ >x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 201, 9))
715
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16))
716
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46))
717
+ }
718
+
719
+ function f53<T, K extends keyof T>(obj: { [x: string]: boolean }, k: K, s: string, n: number) {
720
+ >f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 202, 1))
721
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13))
722
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15))
723
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13))
724
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35))
725
+ >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 204, 43))
726
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65))
727
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15))
728
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71))
729
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82))
730
+
731
+ const x1 = obj[s];
732
+ >x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 205, 9))
733
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35))
734
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71))
735
+
736
+ const x2 = obj[n];
737
+ >x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 206, 9))
738
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35))
739
+ >n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82))
740
+
741
+ const x3 = obj[k];
742
+ >x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 207, 9))
743
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35))
744
+ >k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65))
745
+ }
746
+
747
+ function f54<T>(obj: T, key: keyof T) {
748
+ >f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 208, 1))
749
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13))
750
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16))
751
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13))
752
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23))
753
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13))
754
+
755
+ for (let s in obj[key]) {
756
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 211, 12))
757
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16))
758
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23))
759
+ }
760
+ const b = "foo" in obj[key];
761
+ >b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 213, 9))
762
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16))
763
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23))
764
+ }
765
+
766
+ function f55<T, K extends keyof T>(obj: T, key: K) {
767
+ >f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 214, 1))
768
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13))
769
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15))
770
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13))
771
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35))
772
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13))
773
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42))
774
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15))
775
+
776
+ for (let s in obj[key]) {
777
+ >s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 217, 12))
778
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35))
779
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42))
780
+ }
781
+ const b = "foo" in obj[key];
782
+ >b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 219, 9))
783
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35))
784
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42))
785
+ }
786
+
629
787
// Repros from #12011
630
788
631
789
class Base {
632
- >Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180 , 1))
790
+ >Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220 , 1))
633
791
634
792
get<K extends keyof this>(prop: K) {
635
- >get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184 , 12))
636
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185 , 8))
637
- >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 185 , 30))
638
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185 , 8))
793
+ >get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224 , 12))
794
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225 , 8))
795
+ >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225 , 30))
796
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225 , 8))
639
797
640
798
return this[prop];
641
- >this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180 , 1))
642
- >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 185 , 30))
799
+ >this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220 , 1))
800
+ >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225 , 30))
643
801
}
644
802
set<K extends keyof this>(prop: K, value: this[K]) {
645
- >set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187 , 5))
646
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188 , 8))
647
- >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 188 , 30))
648
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188 , 8))
649
- >value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 188 , 38))
650
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188 , 8))
803
+ >set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227 , 5))
804
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228 , 8))
805
+ >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228 , 30))
806
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228 , 8))
807
+ >value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228 , 38))
808
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228 , 8))
651
809
652
810
this[prop] = value;
653
- >this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180 , 1))
654
- >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 188 , 30))
655
- >value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 188 , 38))
811
+ >this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220 , 1))
812
+ >prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228 , 30))
813
+ >value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228 , 38))
656
814
}
657
815
}
658
816
659
817
class Person extends Base {
660
- >Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191 , 1))
661
- >Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180 , 1))
818
+ >Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231 , 1))
819
+ >Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220 , 1))
662
820
663
821
parts: number;
664
- >parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 193 , 27))
822
+ >parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 233 , 27))
665
823
666
824
constructor(parts: number) {
667
- >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 195 , 16))
825
+ >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235 , 16))
668
826
669
827
super();
670
- >super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180 , 1))
828
+ >super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220 , 1))
671
829
672
830
this.set("parts", parts);
673
- >this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187 , 5))
674
- >this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191 , 1))
675
- >set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187 , 5))
676
- >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 195 , 16))
831
+ >this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227 , 5))
832
+ >this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231 , 1))
833
+ >set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227 , 5))
834
+ >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235 , 16))
677
835
}
678
836
getParts() {
679
- >getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 198 , 5))
837
+ >getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 238 , 5))
680
838
681
839
return this.get("parts")
682
- >this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184 , 12))
683
- >this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191 , 1))
684
- >get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184 , 12))
840
+ >this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224 , 12))
841
+ >this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231 , 1))
842
+ >get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224 , 12))
685
843
}
686
844
}
687
845
688
846
class OtherPerson {
689
- >OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202 , 1))
847
+ >OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242 , 1))
690
848
691
849
parts: number;
692
- >parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 204 , 19))
850
+ >parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 244 , 19))
693
851
694
852
constructor(parts: number) {
695
- >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 206 , 16))
853
+ >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246 , 16))
696
854
697
855
setProperty(this, "parts", parts);
698
856
>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1))
699
- >this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202 , 1))
700
- >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 206 , 16))
857
+ >this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242 , 1))
858
+ >parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246 , 16))
701
859
}
702
860
getParts() {
703
- >getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 208 , 5))
861
+ >getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 248 , 5))
704
862
705
863
return getProperty(this, "parts")
706
864
>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26))
707
- >this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202 , 1))
865
+ >this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242 , 1))
708
866
}
709
867
}
0 commit comments