material-components-web icon indicating copy to clipboard operation
material-components-web copied to clipboard

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

Open VashJuan opened this issue 1 year ago • 5 comments

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<Adapter> extends MDCFoundation<Adapter> { to: export declare class MDCObserverFoundation<Adapter extends {}> extends MDCFoundation<Adapter> { 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...

VashJuan avatar Sep 19 '22 14:09 VashJuan

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

LunaSquee avatar Sep 28 '22 05:09 LunaSquee

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

LunaSquee avatar Sep 28 '22 06:09 LunaSquee

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 avatar Dec 09 '22 19:12 VashJuan

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

VashJuan avatar Dec 09 '22 19:12 VashJuan

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

ilyakonrad avatar Apr 12 '23 12:04 ilyakonrad