|
|
|
|
|
by mdc2161
466 days ago
|
|
If the inner function is async, then its callers need to be async as well (see https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...). Important to note that unless the inner function throws an exception, the two versions are essentially identical, even sharing (if using typescript) a return type definition of `Promise<ReturnType<InnerFunction>>`. That's because `await` flattens nested promises, so both `Awaited<Promise<T>>` and `Awaited<Promise<Promise<Promise<T>>>>` resolve to `T`. |
|