Encountered an issue with TS2322 error while attempting to compile my Angular application.
The error occurs when using a variable [link] that represents the index number. When declaring this variable, I use: @Input() link!: string;
This link is used as a reference for routerLink in the following manner: [routerLink]="link"
If I change the type from link!: string to link!: number, then the TS2322 error is triggered: Type 'number' is not assignable to type 'string | any[] | null | undefined'. specifically in this part of the code:
In my understanding, routerLink expects a string value, so why does it trigger an error when 'link' is already defined as a string? Any thoughts on this?