Hello,
I’m trying to use the Google Drive API v3 in an Ionic 2.3.0 app.
I followed a few guides and came to the following steps:
-
Download and load the API script in
index.html
<script src="https://apis.google.com/js/api.js"></script>
-
Add the types:
npm install --save @types/gapi
npm install --save @types/gapi.auth2
… and in tsconfig.json
{
compilerOptions {
(...)
"types": ["gapi", "gapi.auth2"]
}
}
… and finally init the library in main.ts
declare var gapi: any;
gapi.load('client:auth2', () => {});
Unfortunately ionic serve
is failing with:
[12:17:49] typescript error
[12:17:49] typescript error
Cannot find type definition file for 'gapi'.
Cannot find type definition file for 'gapi.auth2'.
This means that the changes in tsconfig.json
aren’t working. Does any of you know what might be going on?
Thank you!
AP