2

I have a .Net Core Angular 2 project using SystemJs that I have recently upgraded from Typings to @Types.

The project has been completely rebuilt with the latest VS tooling for .Net Core 1.0.1 and TypeScript 2.0.10 and Node.js 7.0.0 as of 12/21/2016.

The project files were working properly before updating to @Types.

I am getting the following Error from @Types/node/index.d.ts:

TS2309 "Build:An export assignment cannot be used in a module with other exported elements." Line 3626

Line 3626 of @Types/node/index.d.ts is the Export for the "assert" module declaration.

Here are me config files

tsconfig.json

"compilerOptions": {
  "target": "es5",
  "module": "commonjs",
  "moduleResolution": "node",
  "sourceMap": true,
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "removeComments": false,
  "noImplicitAny": false,
  "skipLibCheck": true
},
"compileOnSave": true,
"exclude": [
  "node_modules",
  "wwwroot/shared/lib"
]

Package.json

"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
  "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
  "lite": "lite-server",
  "tsc": "tsc",
  "tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
  "@angular/common": "~2.2.0",
  "@angular/compiler": "~2.2.0",
  "@angular/core": "~2.2.0",
  "@angular/forms": "~2.2.0",
  "@angular/http": "~2.2.0",
  "@angular/platform-browser": "~2.2.0",
  "@angular/platform-browser-dynamic": "~2.2.0",
  "@angular/router": "~3.2.0",
  "@angular/upgrade": "~2.2.0",
  "angular-in-memory-web-api": "~0.1.15",

  "core-js": "^2.4.1",
  "reflect-metadata": "^0.1.8",
  "rxjs": "5.0.0-beta.12",
  "systemjs": "0.19.41",
  "zone.js": "^0.6.26",

  "@progress/kendo-angular-grid": "^0.6.1",
  "@progress/kendo-angular-charts": "^0.9.0",
  "@progress/kendo-angular-dropdowns": "^0.16.10",
  "@progress/kendo-angular-inputs": "^0.13.1",
  "@progress/kendo-angular-layout": "^0.15.0",
  "@progress/kendo-angular-dialog": "^0.12.2",
  "@progress/kendo-angular-upload": "^0.10.4",
  "@progress/kendo-angular-buttons": "^0.13.3",
  "@progress/kendo-angular-popup": "^0.13.2",
  "@progress/kendo-angular-scrollview": "^0.5.1",
  "@progress/kendo-angular-sortable": "^0.5.1",
  "@progress/kendo-data-query": "^0.1.6",
  "@telerik/kendo-theme-default": "^1.28.1",

  "jquery": "2.1.1",
  "jquery-validation": "1.15.1",
  "jquery-validation-unobtrusive": "3.2.6",
  "office-ui-fabric-core": "5.0.1",
  "bootstrap": "3.3.7"
},
"devDependencies": {
  "@types/core-js": "^0.9.34",
  "@types/node": "^6.0.49",
  "@types/jasmine": "2.5.38",
  "concurrently": "^3.0.0",
  "lite-server": "^2.2.2",
  "typescript": "^2.0.10",
  "gulp": "3.9.1",
  "gulp-cssmin": "0.1.7",
  "gulp-concat": "2.6.0",
  "gulp-uglify": "2.0.0",
  "gulp-clean": "0.3.2",
  "gulp-typescript": "2.14.1"
},
"repository": {}
}
2
  • Is there a typings.json file in your project and a typings folder or have you changed or removed these? Commented Nov 21, 2016 at 17:12
  • I recreated the project without installing Typings, so there is no Typings folder or typings.json file. In the original project where Typings was installed, I did try to remove the files to avoid duplicates and I ended up with the same error TS2309, which promped me to start over from scratch just to make sure. I am not receiving any "Duplicate Identifier" errors. Commented Nov 21, 2016 at 17:27

1 Answer 1

2

Suggestion from TypeScript guys on GitHub fixed for us.

Do a search for the following -

declare module "assert" {

It should only appear once in your project. We had it in two files - the TypeScript definition file in @types/node package and a 2nd one in our wwwroot folder which needed deleting and had been copied over in error by a Gulp task and was getting picked up by the compiler. Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

Sure enough, reflect-metadata contains a typings folder with a node.d.ts file that declares "assert". I can't delete the file because the compiler complains that it can't find it, but commenting out the declaration fixed the issue and the project is error free again. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.