angular – 将Ionic 2迁移到Typescript 2.0 RC
发布时间:2020-12-17 18:05:18 所属栏目:安全 来源:网络整理
导读:目前我正在使用Ionic 2.0.0-beta.37.其中使用的是typescript 1.8.x.我正在尝试使用打字稿的D3版本4,但 d3-v4-definitelytyped的打字使用Typescript 2.x.我收到了关于打字的编译错误,在 d3-v4-definitelytyped repo发出问题之后,我了解到我需要在Ionic 2项目
目前我正在使用Ionic 2.0.0-beta.37.其中使用的是typescript 1.8.x.我正在尝试使用打字稿的D3版本4,但
d3-v4-definitelytyped的打字使用Typescript 2.x.我收到了关于打字的编译错误,在
d3-v4-definitelytyped repo发出问题之后,我了解到我需要在Ionic 2项目中使用TS 2.x.
这是我得到的错误: TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-axis/index.d.ts(150,30): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-axis/index.d.ts(167,24): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-axis/index.d.ts(173,55): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-axis/index.d.ts(191,24): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-brush/index.d.ts(30,37): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-chord/index.d.ts(38,56): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-chord/index.d.ts(39,25): Error TS1110: Type expected. TypeScript error: /Users/arash1/Projects/brite-front-end/node_modules/@types/d3-chord/index.d.ts(41,59): Error TS1110: Type expected. 我查看了我的主IONIC目录中的package.json文件,并没有看到一个打字稿作为依赖项,所以我认为它正在使用其他东西来定义版本.我知道了: >“ionic-gulp-browserify-typescript”:“2.0.0” 所以我进入了tslint-ionic-rules并看到: "devDependencies": { "typescript": "^1.8.10" } 只是为了尝试我运行npm install typescript @ rc在tslint-ionic-rules node_modules中安装新版本,看看我是否得到了同样的错误.错误仍然存??在. 有人可以就如何这样做提供指导吗? RC最近于MFST Blog宣布. 解决方法
在我开始之前,我还没有完全解决问题,但我至少可以解释一下我尝试过的问题.
确切地说,我没有在我的gulp.file中使用lint,但我注意到ionic2使用了browserify,当你查看ionic-gulp-browserify-typescript模块时,你可以看到: tsifyOptions:{} 您可以使用它来设置您要使用的TS版本. 例: >在本地安装typescript 2.x. 它应该看起来像这样: gulp.task('build',['clean'],function(done){ runSequence( ['sass','html','fonts','scripts'],function(){ buildBrowserify({ minify: isRelease,browserifyOptions: { debug: !isRelease },uglifyOptions: { mangle: false },tsifyOptions: { typescript: require('your typescript') } }).on('end',done); } ); }); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |