Search code examples
angulartypescriptwebpacktypescript2.0angular2-universal

error TS2300: Duplicate identifier 'export='


I am using angular/universal-starter as starter which uses TypeScript 2 and Webpack 2.

I added packages bluebird and nodemailer. After adding these packages and related typings:

"@types/bluebird": "3.0.31",
"@types/nodemailer": "1.3.30",

it gives me this error in the terminal:

ERROR in /project/node_modules/@types/nodemailer/node_modules/@types/bluebird/index.d.ts (772,5): error TS2300: Duplicate identifier 'export='.

ERROR in /project/node_modules/@types/bluebird/index.d.ts (772,1): error TS2300: Duplicate identifier 'export='.

[Not sure whether it helps] Note after installing @types/nodemailer, @type/nodemailer has its own node_modules folder including @type/bluebird (which is an old bluebird typings version 2.0.0):

enter image description here

My tsconfig.json file:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "commonjs",
    "removeComments": true,
    "sourceMap": true,
    "lib": ["es6", "dom"]
  },
  "include": [
    "node_modules/@types/**/*.d.ts",
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "!node_modules/@types/**/*.d.ts"
  ],
  "compileOnSave": false,
  "buildOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

How can I solve this error? Thanks


Solution

  • Not sure what cause it. But after updating all of them to new version packages:

    "bluebird": "3.4.1",
    "nodemailer": "2.5.0",
    "@types/bluebird": "3.0.32",
    "@types/nodemailer": "1.3.31",
    

    And I didn't change any other codes. The issue is gone.