I am doing something like the below in my TS project:
['components.d.ts', '.eslintrc.js'].forEach(fileName => {
console.log(fileName)
})
This is valid JS code and TS should infer fileName
as string and allow me to loop over it. However, I am getting error saying:
Element implicitly has an 'any' type because expression of type '".eslintrc.js"' can't be used to index type 'void'.
Property '.eslintrc.js' does not exist on type 'void'
Unsafe call of an `any` typed value. eslint(@typescript-eslint/no-unsafe-call)
Left side of comma operator is unused and has no side effects. ts(2695)
My tsconfig:
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"@/*": [
"src/*"
],
"@templates/*": [
"src/templates/*"
],
},
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"skipLibCheck": true
},
"exclude": [
"./node_modules",
],
"include": [
"src/**/*"
]
}
Thanks