Ionic 2 and Google Drive API v3 problems


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:

  1. Download and load the API script in index.html
    <script src=""></script>

  2. 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!


Hi, have you ever managed to find a solution for this? Im struggling with the same issue.

No, unfortunately :frowning: . I ended-up using Dropbox for my project!