components: Latest Material2 Types Incorrectly Implement 'CanDisable'

Bug, feature request, or proposal:

Since upgrading material beta from 2.0.0-beta.3 to 2.0.0-beta.4, I’m getting multiple errors for button.d.ts, checkbox.d.ts, radio.d.ts, slide-toggle.d.ts, and slider.d.ts when building.

What is the expected behavior?

The application should build fine with no errors.

What is the current behavior?

When building, I’m getting errors similar to this:

/node_modules/@angular/material/typings/button/button.d.ts(40,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(40,39): error TS2507: Type '(new (...args: any[]) => CanDisable) & typeof MdButtonBase' is not a constructor function type.

These errors are the same for all 5 components mentioned at the top of this issue.

Which versions of Angular, Material, OS, browsers are affected?

Angular 4.0.2, Material 2.0.0-beta.4, Windows 7 & 10, Chrome

Is there anything else we should know?

I have made sure to remove the deprecated “forRoot()”, and I do not use HttpModule from MdIconModule, which are the only breaking changes listed in the changelog.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 24 (5 by maintainers)

Most upvoted comments

Forgot to add this to the changelog: this now requires TypeScript 2.2

Any one who is getting this error and using visual studio IDE. Just update visual studio to version 15.2 and confirm you have Typescript version 2.2.0 in visual studio.

I could resolve this by uninstalling typescript

>npm uninstall typescript -g
>npm uninstall typescript

I did this repeatedly until npm start throws below error ‘tsc’ is not recognized as an internal or external command,

then I installed latest typescript

>npm install -g typescript

Later npm install worked fine for me

Updating VS2017 to version 15.2 did the trick for me.

Use TypeScript version >= 2.2