Body: I'm getting the following TypeScript error in my Angular application:
error TS2322: Type 'any[] | Observable<any[]> | undefined' is not assignable to type 'any[]'. Type 'undefined' is not assignable to type 'any[]'. The error occurs in the following line of code:
The error occurs in the following line of code:
<p-autoComplete [suggestions]="to.options" placeholder="{{to.placeholder}}" (completeMethod)="search($event)">
Here, to.options is of type 'any[] | Observable<any[]> | undefined', and it's causing a type mismatch error.
I have already tried explicitly specifying the type of to.options as any[] in the component code, but the error still persists.
How can I resolve this TypeScript error and ensure that the type of to.options is correctly assigned to type 'any[]'?
Any help would be greatly appreciated. Thank yo u!
I'm Trying add custom autocomplete in formly configuration