Search code examples
angulartypescriptdexie

DEXIE - A function whose decl ared type is neither 'void' nor 'any' must return a value


I'm trying to implement a function that check if a price is in a range.

The data are located in the IndexedDB and I'm using Dexie to work with it.

In this moment I can't compile my soluzion

public checkPrizeChange(codCli: string, codList: string, codArt: string, price: number): Observable<any> {

    this._WebDBService.Listino_Articoli.filter(function (i){
      return (i.codLis == codList && i.codArt == codArt);
    }).toArray().then(
      data => {
        if(data.length != 1)
        {
          return Observable.of(false)
        }
        else{
          if(data[0].prezzoMin >= price && data[0].prezzoMax <= price)
            return Observable.of(true)
          else
            return Observable.of(false)
        }
      }
    );
   }

I don't know what is the properly way to work with dexie...

I just have to check some fields in a row of a DexieTable, nothing hard and return an Observable...

Thanks to support


Solution

  • Add return before this line:

    return this._WebDBService.Listino_Articoli.filter(function (i){