Skip to content

Instantly share code, notes, and snippets.

@thesuhu
Last active December 8, 2023 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thesuhu/7021a0956243f6dbe8034497da229bf0 to your computer and use it in GitHub Desktop.
Save thesuhu/7021a0956243f6dbe8034497da229bf0 to your computer and use it in GitHub Desktop.
How to Solve "ng build" Error TS7015: Element implicitly has an ‘any’ type because index expression is not of type 'number'

How to Solve "ng build" Error TS7015: Element implicitly has an ‘any’ type because index expression is not of type 'number'

Today I got error message when running "ng build" on my project using Angular version 12.0.1. The error message is Error TS7015: Element implicitly has an ‘any’ type because index expression is not of type ‘number’.

To solve this problem, edit the file tsconfig.json (TypeScript compiler configuration) and add the following configuration to the compilerOptions key:

"compilerOptions": {

    "suppressImplicitAnyIndexErrors": true,
    "strictNullChecks": false,
    "strictPropertyInitialization": false,

}

Okay, that's it. hope it helps anyone having the same issue. If you find it useful please star (:star:) & share.

@markchagers
Copy link

That option is deprecated in typescript 5 (angular 17). Any ideas how to solve it without this option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment