Angular 5 找不到 drive
来自 gapi.client
.我所做的是:package.json
:
"@types/gapi.client.drive": "^3.0.0",
tsconfig.app.json
:"types": ["gapi.auth2", "gapi.client", "gapi.client.drive"]
index.html
:<script src="https://apis.google.com/js/platform.js"></script>
我的编辑器(VS Code)和 Angular 都报告如下错误:
Property 'drive' does not exist on type 'typeof client'
,但是
console.log(gapi.client.drive.files);
可以得到我需要的一切。我在这里错过了任何图书馆吗?
最佳答案
确保你安装了所有这些插件。
npm install --save @types/gapi
npm install --save @types/gapi.auth2
npm install --save @types/gapi.client.drive
并在 tsconfig.app.json
在编译器选项部分
"types": ["gapi", "gapi.auth2" ,"gapi.client", "gapi.client.drive"]
在 index.html 文件中你需要添加这个 js。
<script src="https://apis.google.com/js/api.js"></script>
关于angular - 类型 'typeof client' 上不存在“驱动器”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48372348/