So I understand the idea behind async/await is just a prettier way to use promises but apparently I'm not understanding it correctly.
async function a(): Promise <number> {
return 5;
}
This is fine, returns a promise that is resolved with result 5.
async function a(): Promise <number> {
return await new Promise(resolve => {
resolve(5);
});
}
error TS2322: Type '{}' is not assignable to type 'number'.
Property 'includes' is missing in type '{}'.
From what I understand, await will wait for the promise to resolve and return the result, which in this case is 5 and should work as the above example?
Type '{}' is not assignable to type 'number'
seems like a far more appropriate title. – jdgregsona()
? – php_nub_qq