我尝试将材质设计添加到我的项目中,但是当我运行npm start
时出现错误。我尝试按照“使用入门”https://material.angular.io/guide/getting-started
我做了所有步骤,这不起作用。你知道一些关于角度+材料设计的教程吗?
node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(31,22): error TS2420: Class 'MdButtonToggleGroup' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdButtonToggleGroup'.
node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(31,50): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdButtonToggleGroupBase' is not a constructor function type.
node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(90,22): error TS2420: Class 'MdButtonToggleGroupMultiple' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdButtonToggleGroupMultiple'.
node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(90,58): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdButtonToggleGroupBase' is not a constructor function type.
node_modules/@angular/material/typings/button/button.d.ts(54,22): error TS2420: Class 'MdButton' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdButton'.
node_modules/@angular/material/typings/button/button.d.ts(54,22): error TS2420: Class 'MdButton' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdButton'.
node_modules/@angular/material/typings/button/button.d.ts(54,39): error TS2507: Type '(new (...args: any[]) => CanColor) & (new (...args: any[]) => CanDisable) & typeof MdButtonBase' is not a constructor function type.
node_modules/@angular/material/typings/checkbox/checkbox.d.ts(54,22): error TS2420: Class 'MdCheckbox' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdCheckbox'.
node_modules/@angular/material/typings/checkbox/checkbox.d.ts(54,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(54,41): error TS2507: Type '(new (...args: any[]) => CanColor) & (new (...args: any[]) => CanDisable) & typeof MdCheckboxBase' is not a constructor function type.
node_modules/@angular/material/typings/chips/chip.d.ts(30,22): error TS2420: Class 'MdChip' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdChip'.
node_modules/@angular/material/typings/chips/chip.d.ts(30,22): error TS2420: Class 'MdChip' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdChip'.
node_modules/@angular/material/typings/chips/chip.d.ts(30,37): error TS2507: Type '(new (...args: any[]) => CanColor) & (new (...args: any[]) => CanDisable) & typeof MdChipBase' is not a constructor function type.
node_modules/@angular/material/typings/core/option/optgroup.d.ts(8,22): error TS2420: Class 'MdOptgroup' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdOptgroup'.
node_modules/@angular/material/typings/core/option/optgroup.d.ts(8,41): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdOptgroupBase' is not a constructor function type.
node_modules/@angular/material/typings/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts(28,22): error TS2420: Class 'MdPseudoCheckbox' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdPseudoCheckbox'.
node_modules/@angular/material/typings/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts(28,47): error TS2507: Type '(new (...args: any[]) => CanColor) & typeof MdPseudoCheckboxBase' is not a constructor function type.
node_modules/@angular/material/typings/icon/icon.d.ts(50,22): error TS2420: Class 'MdIcon' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdIcon'.
node_modules/@angular/material/typings/icon/icon.d.ts(50,37): error TS2507: Type '(new (...args: any[]) => CanColor) & typeof MdIconBase' is not a constructor function type.
node_modules/@angular/material/typings/menu/menu-item.d.ts(18,22): error TS2420: Class 'MdMenuItem' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdMenuItem'.
node_modules/@angular/material/typings/menu/menu-item.d.ts(18,41): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdMenuItemBase' is not a constructor function type.
node_modules/@angular/material/typings/progress-spinner/progress-spinner.d.ts(28,22): error TS2420: Class 'MdProgressSpinner' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdProgressSpinner'.
node_modules/@angular/material/typings/progress-spinner/progress-spinner.d.ts(28,48): error TS2507: Type '(new (...args: any[]) => CanColor) & typeof MdProgressSpinnerBase' is not a constructor function type.
node_modules/@angular/material/typings/radio/radio.d.ts(32,43): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdRadioGroupBase' is not a constructor function type.
node_modules/@angular/material/typings/radio/radio.d.ts(131,22): error TS2420: Class 'MdRadioButton' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdRadioButton'.
node_modules/@angular/material/typings/radio/radio.d.ts(131,44): error TS2507: Type '(new (...args: any[]) => CanColor) & typeof MdRadioButtonBase' is not a constructor function type.
node_modules/@angular/material/typings/select/select.d.ts(77,22): error TS2420: Class 'MdSelect' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdSelect'.
node_modules/@angular/material/typings/select/select.d.ts(77,22): error TS2420: Class 'MdSelect' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdSelect'.
node_modules/@angular/material/typings/select/select.d.ts(77,39): error TS2507: Type '(new (...args: any[]) => CanColor) & (new (...args: any[]) => CanDisable) & typeof MdSelectBase' is not a constructor function type.
node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(25,22): error TS2420: Class 'MdSlideToggle' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdSlideToggle'.
node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(25,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(25,44): error TS2507: Type '(new (...args: any[]) => CanColor) & (new (...args: any[]) => CanDisable) & typeof MdSlideToggleB...' is not a constructor function type.
node_modules/@angular/material/typings/slider/slider.d.ts(33,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(33,39): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdSliderBase' is not a constructor function type.
node_modules/@angular/material/typings/tabs/tab-label-wrapper.d.ts(17,22): error TS2420: Class 'MdTabLabelWrapper' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdTabLabelWrapper'.
node_modules/@angular/material/typings/tabs/tab-label-wrapper.d.ts(17,48): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdTabLabelWrapperBase' is not a constructor function type.
node_modules/@angular/material/typings/tabs/tab.d.ts(15,22): error TS2420: Class 'MdTab' incorrectly implements interface 'CanDisable'.
Property 'disabled' is missing in type 'MdTab'.
node_modules/@angular/material/typings/tabs/tab.d.ts(15,36): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdTabBase' is not a constructor function type.
node_modules/@angular/material/typings/toolbar/toolbar.d.ts(18,22): error TS2420: Class 'MdToolbar' incorrectly implements interface 'CanColor'.
Property 'color' is missing in type 'MdToolbar'.
node_modules/@angular/material/typings/toolbar/toolbar.d.ts(18,40): error TS2507: Type '(new (...args: any[]) => CanColor) & typeof MdToolbarBase' is not a constructor function type.
答案 0 :(得分:1)
请检查package.json中的打字稿版本。如果typescript版本小于2.2.0,则将其更改为最新版本。 并在终端中运行 npm update -D 。