Typescript Error, Cannot find name 'gapi', transpile failed

前端 未结 1 1288
难免孤独
难免孤独 2020-12-21 03:01

I trying to implement google auth in my ionic2 app. I need it works in browser. So, I installed:

npm install --save @types/gapi
npm install --save @types/gap         


        
相关标签:
1条回答
  • 2020-12-21 03:25

    The current declarations for gapi and for gapi.auth2 are global declarations.

    They might not be automatically with @types because looking into node_modules either requires an explicit import or adding your libraries to the types field in your tsconfig.json.

    So try fixing up the following types field to your compilerOptions:

    "compilerOptions": {
         "types": ["gapi", "gapi.auth2"]
    }
    
    0 讨论(0)
提交回复
热议问题