material-components-web
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
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...
Please fix ASAP! This issue is a big blocker for my client.
Update: You can temporarily circumvent this issue by adding "skipLibCheck": true
to your tsconfig.json
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....
Here is the pull request, its just a 1 line change!!! https://github.com/material-components/material-components-web/pull/7793
I am facing the same issue. Upgrading from Angular 14 to 15, getting
Type 'Adapter' does not satisfy the constraint '{}'.