What happens with a Promise
Same thing with a function that returns void
. A void
function returns undefined
. A Promise<void>
resolves to an undefined
.
function foo(){}; console.log(foo()); // undefined
async function bar(){}; bar().then(res => console.log(res)); // undefined