在我的Angular 6项目中,我将GOjs库放入了TS编译错误

时间:2019-02-21 14:01:06

标签: javascript angular gojs

我刚刚将Gojs包含在当前的角度项目中。

我遵循的步骤

npm install gojs --save

在我的应用程序组件中,我刚刚导入了gojs

import * as go from 'gojs';

之后,当我运行ng服务/构建时,我遇到了以下错误。

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"

2 个答案:

答案 0 :(得分:3)

您需要升级TypeScript版本。
go.d.ts文件需要v2.8。
要升级当前的TypeScript Verison,请执行以下操作:npm install -g typescript@latest

答案 1 :(得分:0)

感谢@walter Northwoods

我刚刚将GOJS 2. *降级为1.8 *

Id  Keyword
1   ayam
2   biaya fuel personal wallet
3   pulsa sms virtualaccount
4   biaya koperasi personal
5   familymart personal
6   pln
7   biaya onus
8   koperasi personal
9   biaya familymart personal
10  fuel
11  fuel

解决了问题。