question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 14 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'. Property 'prototype' is missing in type 'MockMediaQueryList' but required in type 'MediaQueryList'.

See original GitHub issue

Bug Report

What is the current behavior?

ng serve build failed to compile. Shows error below

Error: node_modules/@angular/flex-layout/core/match-media/mock/mock-match-media.d.ts:59:22 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'.
  Property 'prototype' is missing in type 'MockMediaQueryList' but required in type 'MediaQueryList'.

59 export declare class MockMediaQueryList implements MediaQueryList {
                        ~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5162:5
    5162     prototype: EventTarget;
             ~~~~~~~~~
    'prototype' is declared here.

What is the expected behavior?

Complete ng serve compile build

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

package.json below

{
"dependencies": {
    "@angular/animations": "~14.2.5",
    "@angular/cdk": "^14.2.4",
    "@angular/common": "~14.2.5",
    "@angular/compiler": "~14.2.5",
    "@angular/core": "~14.2.5",
    "@angular/flex-layout": "^14.0.0-beta.40",
    "@angular/forms": "~14.2.5",
    "@angular/material": "^14.2.4",
    "@angular/material-moment-adapter": "^14.2.4",
    "@angular/platform-browser": "~14.2.5",
    "@angular/platform-browser-dynamic": "~14.2.5",
    "@angular/router": "~14.2.5",
    "@ngrx/effects": "^14.3.2",
    "@ngrx/store": "^14.3.2",
    "@swimlane/ngx-charts": "^20.1.0",
    "jwt-decode": "^3.1.2",
    "lodash-es": "^4.17.21",
    "moment": "^2.29.4",
    "ngx-cookie-service": "^14.0.1",
    "ngx-mask": "^14.2.3",
    "ngx-mat-select-search": "^5.0.0",
    "ngx-pagination": "^6.0.2",
    "rxjs": "~7.5.7",
    "tslib": "^2.4.0",
    "zone.js": "~0.11.8"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~14.2.5",
    "@angular/cli": "~14.2.5",
    "@angular/compiler-cli": "~14.2.5",
    "@faker-js/faker": "^7.5.0",
    "@ngrx/schematics": "^14.3.2",
    "@types/jasmine": "~4.3.0",
    "@types/lodash-es": "^4.17.6",
    "@types/node": "^18.8.4",
    "@types/uuid": "^8.3.4",
    "jasmine-core": "~4.4.0",
    "karma": "~6.4.1",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.4"
  }
}

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:21
  • Comments:24 (4 by maintainers)

github_iconTop GitHub Comments

21reactions
stockrelcommented, Oct 11, 2022

+1

13reactions
CaerusKarucommented, Oct 12, 2022

v14.0.0-beta.41 has been released to NPM, please upgrade to that version. Unfortunately we will not be backporting this patch to older, unsupported versions, so you have three options for mitigation on an older version:

  1. Set skipLibCheck to true (this is my recommendation for really any project, regardless of circumstance)
  2. Do not use Node v18 or its typings
  3. Upgrade to latest

I am leaving this issue open for now so that discovery is easy for impacted users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 14 flex layout issue - Stack Overflow
Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'. Property 'prototype' is missing in type 'MockMediaQueryList' ...
Read more >
Class incorrectly implements interface in TypeScript | bobbyhadz
The error "Class incorrectly implements interface" occurs when a class implements an interface without specifying all of the properties and methods defined ...
Read more >
angular/flex-layout - Gitter
Error: node_modules/@angular/flex-layout/core/match-media/mock/mock-match-media.d.ts:59:22 - error TS2420: Class 'MockMediaQueryList' incorrectly implements ...
Read more >
Angular Philippines | Live Coding with Angular: | Facebook
Angular 14 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'. Property 'prototype' is missing in type ...
Read more >
Error TS2420: Class 'XRWebGLLayer' incorrectly implements ...
@google/model-viewer-render-fidelity-tools: Property 'prototype' is missing in type 'XRWebGLLayer' but required in type 'EventTarget'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found