An errors blows up when using the typings for the the Google Auth2 API - @types/gapi.auth2
. The compiler throws an error 1062
if I create a promise
This is the way I found to circumvent this error
private async loadGapiAuth() {
await new Promise((resolve) => gapi.load('client:auth2', resolve));
await new Promise((resolve) => gapi.auth2.init(GAPI_CONFIG).then(resolve));
}
then I can do this:
await this.loadGapiAuth();
const auth = gapi.auth2.getAuthInstance();