- Language: Typescript
- Rule: typescript:S7755 - Complex index access patterns should be replaced with “.at()” method
- SonarQube for IDE: 8.29.0.14599 on Visual Studio 2022 (not connected)
This rule should not be triggered for collection types (e.g. NodeList returned by querySelectorAll) which do not have an .at(n) method.
function getLastNode() {
const items = document.querySelectorAll(".someClass"); // not an array
return items[items.length - 1];
}