Angular 5: Argument of type 'void' is not assignment to parameter of type '{} | PromiseLike<{}>'

Viewed 12830

This is my code:

public resetDefaults() {
  return new Promise ((resolve, reject) => {
    resolve(
      this.resetFilters()
    )
  }).then(()=> {return this.cachedFilters});
}

private resetFilters() {

}

The this.resetFilters() is giving me :

Argument of type 'void' is not assignment to parameter of type '{} | PromiseLike<{}>'

I know that if I do:

private resetFilters(): Promise<any> {

}

It would get rid of that error but then I have to create a new promise in that method. I just want to be able to call a function without having to add any more promises. I do need the Promise in resetDefaults() though

1 Answers

use any :

private resetFilters() : any {

}
Related