Eli*_*hen 6 webstorm firebase typescript google-cloud-functions firebase-admin
我使用IDE WebStorm,我在编写云功能时遇到了一些困难.看起来WebStorm无法识别firebase的某些方法/函数/变量.
例:
深红色表示无法解析属性.正如你所看到的,它不承认db.settings,snapshot.data(),db.doc()和snapshot.id.
我的package.json(自动生成,没有触及任何东西):
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "~6.0.0",
"firebase-functions": "^2.0.3"
},
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "~2.8.3"
},
"private": true
}
Run Code Online (Sandbox Code Playgroud)
到目前为止我尝试过没有成功:
@google-cloudfunctions和firebase init functions- 工作片刻然后找不到源.node_modules为了它而不排斥.未包含的套餐:
PS - 我不知道它是否与父文件夹有关,但我在这个项目中使用Ionic 4,而在另一个项目中我只使用Angular并且它表现良好(两个函数文件夹具有完全相同的设置) .
问题是 FireStore 函数实际上是在@google-cloud/firestore作为依赖项安装的插件中声明的firebase-admin,但未在项目中列出package.json。WebStorm 会自动从索引中排除所有间接依赖项以获得更好的性能,因此代码分析器无法使用函数定义。要解决此问题,请右键单击项目工具窗口node_modules/@google-cloud中的文件夹,然后选择将目录标记为/未排除。这应该可以解决问题:
| 归档时间: |
|
| 查看次数: |
307 次 |
| 最近记录: |