Fran Sandi Fran Sandi - 1 month ago 57
TypeScript Question

Duplicate identifier with ionic2 + Firebase 3

I have a problem with the configuration of ionic2 + Firebase 3.

I have executed the following (as i see in a tutorial) to install Firebase and Typings:


  • npm install firebase --save

  • npm install -g typings

  • typings install --save firebase



But when i make ionic serve, i see the following conflicts:

typescript: node_modules/firebase/firebase.d.ts, line: 405
Duplicate identifier 'export='.
typescript: typings/modules/firebase/index.d.ts, line: 498
Duplicate identifier 'export='.


I have googeled very similar problems, but i cant solve it.

I don't understand the problem, the tsconfig.json looks like:

{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"target": "es5"
},
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}


Can anyone help me out of this, please?

Answer

Since the latest release of Ionic 2: RC0 (they released RC1 a couple of days ago) Ionic is no longer working with typings, they moved to @types.

So you do npm install @types/package_name instead of typings install package_name

Usually the @types ecosystem is strong and you wouldn't need anything else, but there are a few issues on how Ionic 2RC0 and Firebase 3 work together, you can check this guide for all the workarounds :)