在我的 Angular 6 项目中,我放置了 GOjs 库,它给出了 TS 编译错误
In my Angular 6 Project I have put GOjs library it is giving TS compile errors
我刚刚将 Gojs 添加到我当前的 angular 项目中。
我遵循的步骤
npm install gojs --save
在我的应用程序组件中,我刚刚导入了 gojs
import * as go from 'gojs';
在那之后,当我 运行 ng serve/build 我得到以下错误。
RROR in node_modules/gojs/release/go.d.ts(14239,27): error TS1005: ')' expected.
node_modules/gojs/release/go.d.ts(14239,45): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14239,68): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14240,16): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14240,38): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14241,43): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14242,5): error TS1138: Parameter declaration expected.
node_modules/gojs/release/go.d.ts(14242,7): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,11): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,12): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,14):
Pacakage.json
"@angular/cli": "~6.0.3",
"@angular/compiler-cli": "~6.0.2",
"@angular/language-service": "~6.0.2",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"gulp": "^4.0.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "~0.2.2",
"minimist": "~1.2.0",
"ng-packagr": "~3.0.0-rc.2",
"protractor": "^5.4.1",
"ts-node": "~5.0.1",
"tsickle": ">=0.25.5",
"tslib": "~1.7.1",
"tslint": "~5.9.1",
"typescript": "^2.7.2"
您需要升级 TypeScript 版本。
go.d.ts 文件需要 v2.8。
要升级您当前的 TypeScript Verison,请执行以下操作:npm install -g typescript@latest
。
谢谢@walter Northwoods,
我刚刚将 GOJS 2.* 降级为 1.8*
npm install gojs@1.8.34
问题已解决。
我刚刚将 Gojs 添加到我当前的 angular 项目中。
我遵循的步骤
npm install gojs --save
在我的应用程序组件中,我刚刚导入了 gojs
import * as go from 'gojs';
在那之后,当我 运行 ng serve/build 我得到以下错误。
RROR in node_modules/gojs/release/go.d.ts(14239,27): error TS1005: ')' expected.
node_modules/gojs/release/go.d.ts(14239,45): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14239,68): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14240,16): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14240,38): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14241,43): error TS1005: ',' expected.
node_modules/gojs/release/go.d.ts(14242,5): error TS1138: Parameter declaration expected.
node_modules/gojs/release/go.d.ts(14242,7): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,11): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,12): error TS1128: Declaration or statement expected.
node_modules/gojs/release/go.d.ts(14242,14):
Pacakage.json
"@angular/cli": "~6.0.3",
"@angular/compiler-cli": "~6.0.2",
"@angular/language-service": "~6.0.2",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"gulp": "^4.0.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "~0.2.2",
"minimist": "~1.2.0",
"ng-packagr": "~3.0.0-rc.2",
"protractor": "^5.4.1",
"ts-node": "~5.0.1",
"tsickle": ">=0.25.5",
"tslib": "~1.7.1",
"tslint": "~5.9.1",
"typescript": "^2.7.2"
您需要升级 TypeScript 版本。
go.d.ts 文件需要 v2.8。
要升级您当前的 TypeScript Verison,请执行以下操作:npm install -g typescript@latest
。
谢谢@walter Northwoods,
我刚刚将 GOJS 2.* 降级为 1.8*
npm install gojs@1.8.34
问题已解决。