gpt4 book ai didi

angular - @Types/node/index.d.ts TypeScript 错误 TS2309

转载 作者:搜寻专家 更新时间:2023-10-30 21:52:33 25 4
gpt4 key购买 nike

我有一个使用 SystemJs 的 .Net Core Angular 2 项目,我最近从 Typings 升级到了 @Types。

截至 2016 年 12 月 21 日,该项目已使用适用于 .Net Core 1.0.1 和 TypeScript 2.0.10 以及 Node.js 7.0.0 的最新 VS 工具完全重建。

项目文件在更新到@Types 之前工作正常。

我从@Types/node/index.d.ts 收到以下错误:

TS2309 “构建:导出分配不能用于具有其他导出元素的模块。” 3626行

@Types/node/index.d.ts 的第 3626 行是“断言”模块声明的导出。

这是我的配置文件

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"
]

包.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": {}
}

最佳答案

GitHub 上 TypeScript 专家的建议为我们修复了。

搜索以下内容 -

declare module "assert" {

它应该只在您的项目中出现一次。我们把它放在两个文件中——@types/node 包中的 TypeScript 定义文件和我们 wwwroot 文件夹中的第二个文件,它需要删除并且被 Gulp 任务错误地复制并被编译器拾取。希望这对您有所帮助!

关于angular - @Types/node/index.d.ts TypeScript 错误 TS2309,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40725540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com