how to make synchronous call in typescript