This is my class.
export MyClass {
private readonly ServiceEndpoint: string =
"/xxx/xxx.DMS.UI.Root/Services/ConfigurationAPI.svc/";
public async GetAllCompanies(): Promise<CompanyDto[]> {
return fetchAsync(
`${this.ServiceEndpoint}Company`,
'GET'
)
.then(value => value.GetAllCompaniesResult);
}
}
Presently, this method returns a Promise <CompanyDto[]>. How do I rewrite it so that it returns only the result CompanyDto[]?
2
Answers
I think you are missing await keyword here. Can you please try using await.
}
}
Just use
await
. Make sure your types are correctly inferred.