With the addition of async / await to TypeScript using Promise (s), it might look syntactically close to the Task (s).
Example:
Promise (TS)
public aync myAsyncFun(): Promise<T> { let value: T = await ... return value; }
Task (C #)
public aync Task<T> MyAsyncFun() { T value = await ... return value; }
I was wondering, on the contrary, there was an equivalent .then () for Task (s).
Example:
Promise (TS)
Promise<T> promise = ... promise.then((result: T) => ...do something...);
source share