After npm install and npm start I get this error with observer
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<Adapter> extends MDCFoundation<Adapter> {
~~~~~~~
node_modules/@material/base/observer-foundation.d.ts:25:44
25 export declare class MDCObserverFoundation<Adapter> extends MDCFoundation<Adapter> {
~~~~~~~
This type parameter might need an `extends {}` constraint.
package.json
{
"name": "ui-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^16.1.5",
"@angular/cdk": "^16.1.5",
"@angular/common": "^16.1.0",
"@angular/compiler": "^16.1.0",
"@angular/core": "^16.1.0",
"@angular/forms": "^16.1.0",
"@angular/material": "^16.1.5",
"@angular/platform-browser": "^16.1.0",
"@angular/platform-browser-dynamic": "^16.1.0",
"@angular/router": "^16.1.0",
"@material/form-field": "^14.0.0",
"@material/grid-list": "^4.0.0",
"@material/theme": "^14.0.0",
"@material/toolbar": "^2.3.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.4",
"@angular/cli": "~16.1.4",
"@angular/compiler-cli": "^16.1.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.1.3"
}
}
ok. I see similar problem https://github.com/angular/components/issues/25657 but when I do
npm install --save @angular/material @angular/cdk
nothing change. Still this same error.
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.
How fix this withou workaround