A Fix To Typescript TS7006: Parameter 'xxxx' Implicitly Has An 'Any' Type

Issue

Sometimes, when you use a new version to create a new Angular project, you might get this kind of errors:

A Fix to Typescript TS7006: Parameter 'xxxx' implicitly has an 'any' type.

The version of Angular we use is 13.1.2:

A Fix to Typescript TS7006: Parameter 'xxxx' implicitly has an 'any' type.

Search online, you will see a bunch of discussions like this:

Typescript: TS7006: Parameter 'xxx' implicitly has an 'any' type

associated with different solutions. Some of them might make some sense, such as this: Typescript: TS7006: Parameter 'xxx' implicitly has an 'any' type, suggesting that 

"In your tsconfig.json file set the parameter "noImplicitAny": false under compilerOptions to get rid of this error."

Most discussions never catch the issue. Actually, this may be just a minor issue with settings.

Reason

If you have any chance to use Angular in previous versions when you create a new project you might see some questions like this

A Fix to Typescript TS7006: Parameter 'xxxx' implicitly has an 'any' type.

"Do you want to enforce stricter type checking and stricter bundle budgets in the workspace?"

If you choose YES, then "this setting helps improve maintainability and catch bugs ahead of time." And therefore, if you do not define the type, you will get error message such as TS7006, or TS2322.

You can see from the screenshot, the Angular version I used was 11.2.4, while my newly created Angular app with version 13.1.2. I do not know from which version, the "enforce stricter type checking" warning was got rid of, and with a stricter checking as a default setting. But I do have an Angular version 12.2.6 that has the same behavior as version 13.

So, we might say, before and on Angular version 11, when opening a new project, one had choices to choose either stricter type checking or not, while after version 12, the stricter type checking becomes default settings.

Fix

One can either follow the stricter type checking rule, or one can manually switch the stricter type checking to false --- then the errors will be gone:

A Fix to Typescript TS7006: Parameter 'xxxx' implicitly has an 'any' type.

Summary

This article is a fix of a popular Angular exception:Typescript TS7006: Parameter 'xxxx' implicitly has an 'any' type.

References

We can see tons of articles discussion online about this exception, we quote several here,