You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Intellisense doesn't show type info about array index access on hoverΒ #59696
Array index access, e.g. arr[0], to show type info when hovering over the index.
π Motivating Example
constarr=[0,1]arr[0]// π₯ no hover. Expected "(property) 0: number" or "(property) 0?: number | undefined" with `noUncheckedIndexedAccess`arr['1']// π₯ no hover. Expected "(property) 1: number" or "(property) 1?: number | undefined" with `noUncheckedIndexedAccess`arr['0']// π₯ no hover. Expected "(property) 0: number" or "(property) 0?: number | undefined" with `noUncheckedIndexedAccess`arr[1]// π₯ no hover. Expected "(property) 1: number" or "(property) 1?: number | undefined" with `noUncheckedIndexedAccess`arr[2]// π₯ no hover. Expected "(property) 2: number" or "(property) 2?: number | undefined" with `noUncheckedIndexedAccess`// for comparisonconstobj={0: 0,'1': 1,key: 2}consttuple=[0,1]asconstconstextendedArr=Object.assign([0,1],{key: 2})obj.key// β okobj['key']// β okobj[0]// β okobj['1']// β okobj['0']// β okobj[1]// β oktuple[0]// β oktuple['1']// β oktuple['0']// β oktuple[1]// β oktuple[2]// β ok (fails type check as expected)extendedArr.key// β okextendedArr['key']// β okextendedArr[0]// π₯ no hoverextendedArr['1']// π₯ no hoverextendedArr['0']// π₯ no hoverextendedArr[1]// π₯ no hover
Activity
jcalz commentedon Aug 20, 2024
Looks like #58908
typescript-bot commentedon Aug 23, 2024
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.