node_modules/@firebase/firestore/dist/index.d.ts:27:28 中的错误 - 错误 TS1005:预期为“]”
ERROR in node_modules/@firebase/firestore/dist/index.d.ts:27:28 - error TS1005: ']' expected
我试图将 firebase 包含到我的 angular 应用程序中,我导入了所有但当我 运行 ng serve
我收到此错误:
ERROR in node_modules/@firebase/firestore/dist/index.d.ts:27:28 - error TS1005: ']' expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~~
node_modules/@firebase/firestore/dist/index.d.ts:27:47 - error TS1005: ';' expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:27:49 - error TS1109: Expression expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:27:50 - error TS1109: Expression expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:28:1 - error TS1128: Declaration or statement expected.
28 };
我在网上搜索了一下,发现了很多关于这个的信息。
我尝试了以下操作:
- 将
@angular/fire
包降级为 6.1.5
- 增加打字稿版本。
- 重新安装
node_modules
。
我尝试了所有在互联网上找到的解决方案,但我不知道如何解决它。
我用的是Anguar 10
这是我的package.json
。
{
"name": "xxxxxxxx",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~10.2.4",
"@angular/cdk": "^10.2.7",
"@angular/common": "~10.2.4",
"@angular/compiler": "~10.2.4",
"@angular/core": "~10.2.4",
"@angular/fire": "^7.3.0",
"@angular/forms": "~10.2.4",
"@angular/material": "^10.2.7",
"@angular/platform-browser": "~10.2.4",
"@angular/platform-browser-dynamic": "~10.2.4",
"@angular/router": "~10.2.4",
"@datorama/akita-ng-entity-service": "^7.0.0",
"@ngrx/store": "^10.1.2",
"angularfire2": "^5.0.0-rc.7",
"bootstrap": "^5.1.3",
"firebase": "^9.0.2",
"normalize.css": "^8.0.1",
"rxjs": "~6.6.0",
"sha1": "^1.1.1",
"tslib": "^2.4.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.3",
"@angular/cli": "~10.2.3",
"@angular/compiler-cli": "~10.2.4",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.20.49",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"sass": "^1.50.1",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "^4.0.8"
}
}
我自己解决了如下:
- 我用了
@angular/fire 6.1.5
和firebase 8.10.0
- 我删除了
node_modules
.
- 我在
package.json
中手动添加了包。
- 然后我重新安装
npm install
它对我有用
npm install typescript@latest
我试图将 firebase 包含到我的 angular 应用程序中,我导入了所有但当我 运行 ng serve
我收到此错误:
ERROR in node_modules/@firebase/firestore/dist/index.d.ts:27:28 - error TS1005: ']' expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~~
node_modules/@firebase/firestore/dist/index.d.ts:27:47 - error TS1005: ';' expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:27:49 - error TS1109: Expression expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:27:50 - error TS1109: Expression expected.
27 [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
~
node_modules/@firebase/firestore/dist/index.d.ts:28:1 - error TS1128: Declaration or statement expected.
28 };
我在网上搜索了一下,发现了很多关于这个的信息。
我尝试了以下操作:
- 将
@angular/fire
包降级为6.1.5
- 增加打字稿版本。
- 重新安装
node_modules
。
我尝试了所有在互联网上找到的解决方案,但我不知道如何解决它。
我用的是Anguar 10
这是我的package.json
。
{
"name": "xxxxxxxx",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~10.2.4",
"@angular/cdk": "^10.2.7",
"@angular/common": "~10.2.4",
"@angular/compiler": "~10.2.4",
"@angular/core": "~10.2.4",
"@angular/fire": "^7.3.0",
"@angular/forms": "~10.2.4",
"@angular/material": "^10.2.7",
"@angular/platform-browser": "~10.2.4",
"@angular/platform-browser-dynamic": "~10.2.4",
"@angular/router": "~10.2.4",
"@datorama/akita-ng-entity-service": "^7.0.0",
"@ngrx/store": "^10.1.2",
"angularfire2": "^5.0.0-rc.7",
"bootstrap": "^5.1.3",
"firebase": "^9.0.2",
"normalize.css": "^8.0.1",
"rxjs": "~6.6.0",
"sha1": "^1.1.1",
"tslib": "^2.4.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.3",
"@angular/cli": "~10.2.3",
"@angular/compiler-cli": "~10.2.4",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.20.49",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"sass": "^1.50.1",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "^4.0.8"
}
}
我自己解决了如下:
- 我用了
@angular/fire 6.1.5
和firebase 8.10.0
- 我删除了
node_modules
. - 我在
package.json
中手动添加了包。 - 然后我重新安装
npm install
它对我有用
npm install typescript@latest