I encountered an unfamiliar compile error.
When I have an EntityState and store Persons in the store, then attempt to check if a specific id exists, I attempted the following code:
this.store.select(fromPersonSelectors.selectPersonIds)
.pipe(tap(theIds => console.log("pipe-tab theIds"+typeof theIds)))
.pipe(filter(theIds => {
if (theIds !== null && isNumberArray(theIds)) {
theIds.find((oneId:number) => oneId.toFixed(0) === this.personId)
// !==this.personId
}
}), take(1))
...
export function isNumberArray(array: string[] | number[]): array is number[] {
return typeof array[0] === 'number';
}
The selectPersonIds comes from the entity library, '@ngrx/entity', which is utilized by the store:
export interface EntitySelectors<T, V> {
selectIds: (state: V) => string[] | number[];
V represents the PersonDTO
An error occurs during compilation with the second .pipe (.pipe(filter(theIds => {), stating:
TS2769: No overload matches this call. Overload 1 of 5, '(predicate: (value: string[] | number[], index: number) => value is string[] | number[]): OperatorFunction
Any assistance will be greatly appreciated, thank you in advance.