@@ -1699,83 +1699,110 @@ function addToMyThingy<S extends KeyTypes>(key: S) {
1699
1699
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
1700
1700
}
1701
1701
1702
+ // Repro from #13102
1703
+
1704
+ type Handler<T> = {
1705
+ >Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 463, 1))
1706
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 13))
1707
+
1708
+ onChange: (name: keyof T) => void;
1709
+ >onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19))
1710
+ >name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 468, 15))
1711
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 13))
1712
+
1713
+ };
1714
+
1715
+ function onChangeGenericFunction<T>(handler: Handler<T & {preset: number}>) {
1716
+ >onChangeGenericFunction : Symbol(onChangeGenericFunction, Decl(keyofAndIndexedAccess.ts, 469, 2))
1717
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 471, 33))
1718
+ >handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 471, 36))
1719
+ >Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 463, 1))
1720
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 471, 33))
1721
+ >preset : Symbol(preset, Decl(keyofAndIndexedAccess.ts, 471, 58))
1722
+
1723
+ handler.onChange('preset')
1724
+ >handler.onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19))
1725
+ >handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 471, 36))
1726
+ >onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19))
1727
+ }
1728
+
1702
1729
// Repro from #13285
1703
1730
1704
1731
function updateIds<T extends Record<K, string>, K extends string>(
1705
- >updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 463 , 1))
1706
- >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467 , 19))
1732
+ >updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 473 , 1))
1733
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 477 , 19))
1707
1734
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
1708
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467 , 47))
1709
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467 , 47))
1735
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477 , 47))
1736
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477 , 47))
1710
1737
1711
1738
obj: T,
1712
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467 , 66))
1713
- >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467 , 19))
1739
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477 , 66))
1740
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 477 , 19))
1714
1741
1715
1742
idFields: K[],
1716
- >idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468 , 11))
1717
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467 , 47))
1743
+ >idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 478 , 11))
1744
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477 , 47))
1718
1745
1719
1746
idMapping: { [oldId: string]: string }
1720
- >idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469 , 18))
1721
- >oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 470 , 18))
1747
+ >idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 479 , 18))
1748
+ >oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 480 , 18))
1722
1749
1723
1750
): Record<K, string> {
1724
1751
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
1725
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467 , 47))
1752
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477 , 47))
1726
1753
1727
1754
for (const idField of idFields) {
1728
- >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472 , 14))
1729
- >idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468 , 11))
1755
+ >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482 , 14))
1756
+ >idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 478 , 11))
1730
1757
1731
1758
const newId = idMapping[obj[idField]];
1732
- >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473 , 13))
1733
- >idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469 , 18))
1734
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467 , 66))
1735
- >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472 , 14))
1759
+ >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483 , 13))
1760
+ >idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 479 , 18))
1761
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477 , 66))
1762
+ >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482 , 14))
1736
1763
1737
1764
if (newId) {
1738
- >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473 , 13))
1765
+ >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483 , 13))
1739
1766
1740
1767
obj[idField] = newId;
1741
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467 , 66))
1742
- >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472 , 14))
1743
- >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473 , 13))
1768
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477 , 66))
1769
+ >idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482 , 14))
1770
+ >newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483 , 13))
1744
1771
}
1745
1772
}
1746
1773
return obj;
1747
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467 , 66))
1774
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477 , 66))
1748
1775
}
1749
1776
1750
1777
// Repro from #13285
1751
1778
1752
1779
function updateIds2<T extends { [x: string]: string }, K extends keyof T>(
1753
- >updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 479 , 1))
1754
- >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483 , 20))
1755
- >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 483 , 33))
1756
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483 , 54))
1757
- >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483 , 20))
1780
+ >updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 489 , 1))
1781
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493 , 20))
1782
+ >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 493 , 33))
1783
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 493 , 54))
1784
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493 , 20))
1758
1785
1759
1786
obj: T,
1760
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483 , 74))
1761
- >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483 , 20))
1787
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 493 , 74))
1788
+ >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493 , 20))
1762
1789
1763
1790
key: K,
1764
- >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484 , 11))
1765
- >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483 , 54))
1791
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 494 , 11))
1792
+ >K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 493 , 54))
1766
1793
1767
1794
stringMap: { [oldId: string]: string }
1768
- >stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485 , 11))
1769
- >oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 486 , 18))
1795
+ >stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 495 , 11))
1796
+ >oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 496 , 18))
1770
1797
1771
1798
) {
1772
1799
var x = obj[key];
1773
- >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488 , 7))
1774
- >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483 , 74))
1775
- >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484 , 11))
1800
+ >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 498 , 7))
1801
+ >obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 493 , 74))
1802
+ >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 494 , 11))
1776
1803
1777
1804
stringMap[x]; // Should be OK.
1778
- >stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485 , 11))
1779
- >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488 , 7))
1805
+ >stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 495 , 11))
1806
+ >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 498 , 7))
1780
1807
}
1781
1808
0 commit comments