2016-11-21 69 views
2

我使用我最近從分型到@Types升級SystemJs一個.net核心角2項目。@類型/節點/ index.d.ts打字稿錯誤TS2309

該項目已與最新的VS工具對.NET核心1.0.1和2.0.10打字稿和Node.js的7.0.0截至2016年12月21日被徹底重建。

項目文件被更新到@Types之前正常工作。

我從@類型/節點/ index.d.ts收到以下錯誤:

TS2309「構建:一個出口分配不能與其他出口元素模塊中使用」線3626

@類型/節點/ index.d.ts的3626線是出口的「斷言」模塊聲明。

這裏是我的配置文件

tsconfig.json從GitHub上打字稿固定的傢伙爲我們

"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": {} 
} 
+0

有沒有在您的項目typings.json文件和文件夾的分型或你更改或刪除這些? – MIP1983

+0

我沒有安裝類型就重新創建了項目,所以沒有Typings文件夾或typings.json文件。在安裝了Typings的原始項目中,我嘗試刪除這些文件以避免重複,最後導致了TS2309錯誤,它使我從頭開始重新確認。我沒有收到任何「重複標識符」錯誤。 – David

回答

1

建議。

做一個搜索以下 -

declare module "assert" { 

它應該只在您的項目中出現一次。我們把它放在兩個文件中 - @ types/node包中的TypeScript定義文件和我們wwwroot文件夾中的第二個文件,它們需要刪除,並且已經被Gulp任務錯誤地複製過來,並且被編譯器接收。希望這可以幫助!

+0

果然,反射元數據包含一個類型爲「assert」的node.d.ts文件。我無法刪除該文件,因爲編譯器抱怨找不到它,但是註釋掉聲明可以解決問題,並且該項目又無錯誤。謝謝! – David