derivablejs icon indicating copy to clipboard operation
derivablejs copied to clipboard

Typescript error when declare function, that returns promise to Derivable.

Open PFight opened this issue 8 years ago • 0 comments

I cant declare function, that returns promise to Derivable. Reason is next:

Minimal exmaple in playground

interface Some {
  then(callback);
}

// Error: the return type of an async function must either be a valid promise or must not contain a callable 'then' member.
async function foo(): Promise<Some> {
  return null;
}

StackOverflow question

Because of that I can't use async/await.

Looks like we should rename then method to chain

PFight avatar Nov 04 '17 13:11 PFight