I want to call an async function synchronously. I am doing this by calling without await. But the async function itself is making a call to another async API method using await . Will this convert my synchronous call to asynchronous?
const myCall = this.myclient.getAssessment(); < --- Is this still going to be synchronous or will it be converted to async?
Client:
const async getAssessment(): Promise<>{
const callThirdAPI = await this.anotherClient.getValue()
}
I want to wait for this.myclient.getAssessment() to return the value so that I can use myCall later in the code.
I was thinking of calling it asyncly and using .then() to read the value and return it, but typescript is throwing an error saying I am not returning the specified value.
This is what I was thinking:
private myFunction(){
const myCall = await this.myclient.getAssessment();
myCall.then((response) => {
return response
});
}
But typescript complains that myFunction() is not returning a value.