角4材质 [英] Angular 4 with material

查看:62
本文介绍了角4材质的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Angular4实现角材料".我从角材料[angular.material.io] [1]

I am trying to implement "Angular-Material" with Angular4. I made all setup from official site of angular material [angular.material.io][1]

[1]: https://material.angular.io/guide/getting-started ,但是尝试通过npm start运行项目时,出现以下错误:

[1]: https://material.angular.io/guide/getting-started but when trying to run project by npm start, getting following error:

node_modules/@angular/material/typings/button/button.d.ts(40,22): 错误TS2420:类"MdButton"错误地实现了接口 'CanDisable'.属性"disabled"在类型"MdButton"中是私有的,但是 不在"CanDisable"类型中. node_modules/@angular/material/typings/button/button.d.ts(40,39): 错误TS2507:类型为'(new(... args:any [])=> CanDisable)&类型 MdButtonBase'不是构造函数类型. node_modules/@angular/material/typings/checkbox/checkbox.d.ts(43,22): 错误TS2420:"MdCheckbox"类错误地实现了接口 'CanDisable'.类型"MdCheckbox"中缺少属性已禁用". node_modules/@angular/material/typings/checkbox/checkbox.d.ts(43,41): 错误TS2507:类型为'(new(... args:any [])=> CanDisable)&类型 MdCheckboxBase'不是构造函数类型. node_modules/@angular/material/typings/radio/radio.d.ts(24,22):错误 TS2420:类"MdRadioGroup"错误地实现了接口 'CanDisable'.类型"MdRadioGroup"中缺少属性"disabled". node_modules/@angular/material/typings/radio/radio.d.ts(24,43):错误 TS2507:输入'(new(... args:any [])=> CanDisable)&类型 MdRadioGroupBase'不是构造函数类型. node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(14,22): 错误TS2420:"MdSlideToggle"类错误地实现了接口 'CanDisable'.类型中缺少属性已禁用" 'MdSlideToggle'. node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(14,44): 错误TS2507:类型为'(new(... args:any [])=> CanDisable)&类型 MdSlideToggleBase'不是构造函数类型. node_modules/@angular/material/typings/slider/slider.d.ts(26,22): 错误TS2420:"MdSlider"类错误地实现了接口 'CanDisable'.类型"MdSlider"中缺少属性已禁用". node_modules/@angular/material/typings/slider/slider.d.ts(26,39): 错误TS2507:类型为'(new(... args:any [])=> CanDisable)&类型 MdSliderBase'不是构造函数类型.

node_modules/@angular/material/typings/button/button.d.ts(40,22): error TS2420: Class 'MdButton' incorrectly implements interface 'CanDisable'. Property 'disabled' is private in type 'MdButton' but not in type 'CanDisable'. node_modules/@angular/material/typings/button/button.d.ts(40,39): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdButtonBase' is not a constructor function type. node_modules/@angular/material/typings/checkbox/checkbox.d.ts(43,22): error TS2420: Class 'MdCheckbox' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdCheckbox'. node_modules/@angular/material/typings/checkbox/checkbox.d.ts(43,41): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdCheckboxBase' is not a constructor function type. node_modules/@angular/material/typings/radio/radio.d.ts(24,22): error TS2420: Class 'MdRadioGroup' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdRadioGroup'. node_modules/@angular/material/typings/radio/radio.d.ts(24,43): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdRadioGroupBase' is not a constructor function type. node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(14,22): error TS2420: Class 'MdSlideToggle' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdSlideToggle'. node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(14,44): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdSlideToggleBase' is not a constructor function type. node_modules/@angular/material/typings/slider/slider.d.ts(26,22): error TS2420: Class 'MdSlider' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdSlider'. node_modules/@angular/material/typings/slider/slider.d.ts(26,39): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdSliderBase' is not a constructor function type.

有人,请帮助我修复上面的问题.

Somebody, please help me to fix above.

推荐答案

再次检查您的package.json依赖项和devDependencies文件,并找到您的打字稿安装.确保它是2.2.0或更高版本.

Double check your package.json dependencies and devDependencies file and find your typescript install. Make certain it is 2.2.0 or greater.

"typescript": "~2.2.0"

如果进行更改,请确保随后运行

If you make a change, be sure to then run

$ npm update -D

如果您已将其全局安装,并且package.json文件中没有打字稿行,请运行

If you have it installed globally and there is no typescript line in your package.json file, run

$ npm install -g typescript@2.2.0

这篇关于角4材质的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆