When adding firebase to my Angular app, I encountered an error while running 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 };
I tried various solutions found online:
- Downgrading the
@angular/fire
package to version6.1.5
- Updating the TypeScript version
- Reinstalling the
node_modules
Despite trying all the suggested fixes, I am still unable to resolve the issue.
The Angular version I'm using is 10.
Below is a snippet of my package.json
file.
{
"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,
... (remaining content of package.json)
}