When using my Windows machine with VSCode, React/NextJS, and Typescript, a cat unexpectedly hopped onto my laptop. Once the cat left, I encountered a strange issue with my Typescript code which was throwing errors related to array methods.
Below is the code snippet showcasing the errors:
Edit: I am adding an example code snippet
const hello = ["hi", "hi2", "hi3"]
if (hello.length > 2){
console.log("hi")
}
Error: Property 'length' does not exist on type 'string[]'.ts(2339)
const arrray = ["hi", "hi2", "hi3"]
const why = arrray[1]
Error: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'string[]'.
Property '1' does not exist on type 'string[]'.ts(7053)
typing arrray. in VSCode gives me 8 options, copyWithin, entries, fill, find, findIndex, flat, flatMap, includes