Hey everyone! In the latest version of angular (v13), the team has enabled an option called noPropertyAccessFromIndexSignature
. This option will produce some errors, so here are two options for fixing them in upcoming lectures.
In either the tsconfig.json or tsconfig.app.json files, you can set the noPropertyAccessFromIndexSignature
to false
inside the compilerOptions
object. This should effectively disable the option.
If you prefer to keep this option enabled, you will need to access properties with square brackets instead of dot syntax. For example, let's say you were accessing a property like so: form.name
And it produces the following error: Property 'name' comes from an index signature, so it must be accessed with ['name']
You will need to change your syntax to this: form['name']
Interested in learning more? Check out this link for more info: https://www.typescriptlang.org/tsconfig#noPropertyAccessFromIndexSignature