npm install --save @types/gapi
npm install --save @types/gapi.auth2
"compilerOptions": {
...
"types": ["gapi", "gapi.auth2"],
...
}
<head>
...
<!-- Notice there is no 'async' or 'defer' -->
<script src="https://apis.google.com/js/api.js"></script>
</head>