material-components / material-components-web

Modular and customizable Material Design UI components for the web
https://material.io/develop/web
MIT License
17.15k stars 2.15k forks source link

[MDCObjerverFoundation]: Upgrade 14.0.2 to 14.2.2 causes "node_modules/@material/base/observer-foundation.d.ts:25:75 - error TS2344: Type 'Ada #7727

Open VashJuan opened 2 years ago

VashJuan commented 2 years ago

Bug report

I'm using pretty basic functions from Material, but after upgrading to 14.2.2 get: Error: node_modules/@material/base/observer-foundation.d.ts:25:75 - error TS2344: Type 'Adapter' does not satisfy the constraint '{}'. 25 export declare class MDCObserverFoundation extends MDCFoundation {


node_modules/@material/base/observer-foundation.d.ts:25:44
25 export declare class MDCObserverFoundation extends MDCFoundation {

This type parameter might need an extends {} constraint.`

Expected Behavior compilation without errors

Your Environment:

Software Version(s)

Angular: 14.2.2 CDK/Material: 14.2.2 Browser(s): Chrome (latest updates) Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 (all updates)

Possible solution

Going from: export declare class MDCObserverFoundation extends MDCFoundation { to: export declare class MDCObserverFoundation<Adapter extends {}> extends MDCFoundation { in file node_modules/@material/base/observer-foundation.d.ts:25:75 seems to fix it.

Previously reported as https://github.com/angular/components/issues/25657, but they said it was yours...

LunaSquee commented 2 years ago

Please fix ASAP! This issue is a big blocker for my client.

LunaSquee commented 2 years ago

Update: You can temporarily circumvent this issue by adding "skipLibCheck": true to your tsconfig.json

VashJuan commented 1 year ago

Any plans to include this simple pull request? Anyone using this code in Typescript needs to redo this fix every time we update Angular. Uggg!

Others should also add comments/requests for this as I suspect the team only looks at issues with recent activity or a number of reports....

VashJuan commented 1 year ago

Here is the pull request, its just a 1 line change!!! https://github.com/material-components/material-components-web/pull/7793

ilyakonrad commented 1 year ago

I am facing the same issue. Upgrading from Angular 14 to 15, getting Type 'Adapter' does not satisfy the constraint '{}'.