its.david
its.david

Reputation: 2235

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


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

Upvotes: 3

Views: 12979

Answers (1)

El houcine bougarfaoui
El houcine bougarfaoui

Reputation: 37373

use any :

private resetFilters() : any {

}

Upvotes: 10

Related Questions