Hi there, great set of notes on the subject!
I would add to your notes that returning any value from any async function makes it a promise as well. So returning a number will make it a Promise<number> in the end. Which can simplify asynchronous function definitions from this
number
Promise<number>
function promiseNumber() { return Promise.resolve(123); }
to this
async function promiseNumber() { return 123; }
Of course, this will work with anything.
Thank you Amin!
Async is supposed to come before the function keyword
Yes you are right, gonna correct my mistake right away. Thank you.
Really good note didn't know this
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi there, great set of notes on the subject!
I would add to your notes that returning any value from any async function makes it a promise as well. So returning a
number
will make it aPromise<number>
in the end. Which can simplify asynchronous function definitions from thisto this
Of course, this will work with anything.
Thank you Amin!
Async is supposed to come before the function keyword
Yes you are right, gonna correct my mistake right away. Thank you.
Really good note didn't know this