Typescript wait for async function to finish