0

Hey I'd like to ask you if there is any difference between those two code snippets.

//version 1
  public async xxx(
    item: Item
  ): Promise<any> {
    const response = await function();
    return this.merge(response);
  }
//version 2
  public async xxx(
    item: Item
  ): Promise<any> {
    const response = await function();
    return await this.merge(response);
  }

//Calling code: 
const result = await this.xxx(item);

So in both cases I am calling xxx method with await statement, but in first example I have return with await and in the second without. What's the difference? Do they both return Promise anyways?

filemonczyk
  • 1,613
  • 5
  • 26
  • 47

0 Answers0