GithubHelp home page GithubHelp logo

Angular 14 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'. Property 'prototype' is missing in type 'MockMediaQueryList' but required in type 'MediaQueryList'. about flex-layout HOT 25 CLOSED

jrayga avatar jrayga commented on May 27, 2024 21
Angular 14 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'. Property 'prototype' is missing in type 'MockMediaQueryList' but required in type 'MediaQueryList'.

from flex-layout.

Comments (25)

stockrel avatar stockrel commented on May 27, 2024 21

+1

from flex-layout.

CaerusKaru avatar CaerusKaru commented on May 27, 2024 13

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.

from flex-layout.

burner avatar burner commented on May 27, 2024 8

I got the hammer and added "skipLibCheck": true to the tsconfig.json to get it to work

from flex-layout.

CaerusKaru avatar CaerusKaru commented on May 27, 2024 8

Tracking fix, will land in v14: #1424

from flex-layout.

anisabboud avatar anisabboud commented on May 27, 2024 7

@CaerusKaru Thank you for the quick fix!!

Can the new version (beta.41) be published to npm?

from flex-layout.

marklbarlow avatar marklbarlow commented on May 27, 2024 6

I'm pretty sure this is caused by:

"@types/node": "^18.8.4"

18.8.3 seems to work fine.

from flex-layout.

burner avatar burner commented on May 27, 2024 3

But, it concerns me because "skipLibCheck" will probably mask a lot of future issues.

Yes, as soon as there is a patch for this on the flex-layout side, I'll will update to it and set skipLibCheck to false.

from flex-layout.

polterguy avatar polterguy commented on May 27, 2024 2

I got the hammer and added "skipLibCheck": true to the tsconfig.json to get it to work

This works perfect! Thank you, you're a life saver! If anybody knows how to avoid this in the future, I would appreciate it! Our entire infrastructure for building frontends is DOWN ...!!

And we allow for our users to "generate" frontends, which is our primary product, so it's a big deal for us!!

Thank you a bajillion times ^_^

from flex-layout.

polterguy avatar polterguy commented on May 27, 2024

+1

from flex-layout.

StevenDieu avatar StevenDieu commented on May 27, 2024

+1

from flex-layout.

alexdaud avatar alexdaud commented on May 27, 2024

+1

from flex-layout.

thecerber avatar thecerber commented on May 27, 2024

I was helped the downgrade version of rxjs to 6.5.3

from flex-layout.

smarza avatar smarza commented on May 27, 2024

I was helped the downgrade version of rxjs to 6.5.3

Downgrading the rxjs to 6.5.3 worked but it also changed a lot of import paths like filter and tap (rxjs) for example.
So, that´s not the ideal fix to my projects.

Appreciate your help.

from flex-layout.

smarza avatar smarza commented on May 27, 2024

Worked beautifully for now.

But, it concerns me because "skipLibCheck" will probably mask a lot of future issues.
So use with care. :)

For now, I´m going to enable skipLibCheck too.

Thanks a lot.

from flex-layout.

CaerusKaru avatar CaerusKaru commented on May 27, 2024

I recognize this as a wide-reaching issue, I am not dismissing this. Unfortunately, I'm not able to reproduce this issue in our repo even with the exact dependencies listed. Can someone provide a minimal reproduction I can look into? If provided, this will be investigated expeditiously (but the repro must be minimal).

from flex-layout.

aolszowka avatar aolszowka commented on May 27, 2024

@CaerusKaru Sorry for asking the obvious but did you clear out your package-lock.json before attempting to reproduce it? I believe its because many people (ourselves included) have floating dependencies and no package-lock.json (I know, a discussion for another time...). If you've done that I will work towards getting a minimal repro for you unless someone beats me to the punch.

from flex-layout.

danny-nieruch avatar danny-nieruch commented on May 27, 2024

I've just created a new angular project, added the flex-layout dependency and imported the FlexLayoutModule to the app.module.ts. I'm getting the same error:

"Property 'prototype' is missing in type 'MockMediaQueryList' but required in type 'MediaQueryList'."

package.json:

{
  "name": "angular14latest",
  "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": "^14.2.0",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "@angular/flex-layout": "^14.0.0-beta.40",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.5",
    "@angular/cli": "~14.2.5",
    "@angular/compiler-cli": "^14.2.0",
    "@types/jasmine": "~4.0.0",
    "jasmine-core": "~4.3.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.7.2"
  }
}

from flex-layout.

CaerusKaru avatar CaerusKaru commented on May 27, 2024

@marklbarlow is correct. Node v18 typings mean that the type in question extends EventTarget, which is a breaking change. Since Angular Layout doesn't yet support Node v18, and likely won't until Angular v15 is released, I don't see this as being fixed in v14 unless I can find a non-breaking way to resolve this, which I am not ruling out yet. If there is a breaking version for this, we will cut a pre-emptive v15 release. Ordinarily we wait for v15 final, but this is a special circumstance.

from flex-layout.

tarlepp avatar tarlepp commented on May 27, 2024

Just faced this same issue - and looks like there is some work already done - great!

from flex-layout.

VashJuan avatar VashJuan commented on May 27, 2024

Also reported as:
angular/angular#47736
I'll put a note to refer to this issue...

from flex-layout.

sumitsarraf avatar sumitsarraf commented on May 27, 2024

+1

from flex-layout.

polterguy avatar polterguy commented on May 27, 2024

Thx guys and gals, finally our stuff is working again. I applied the skipLibCheck as a temporary fix and things are building ...

Note2self - Include the "package-lock.json" file in the git repo ... :/

from flex-layout.

aceArt-GmbH avatar aceArt-GmbH commented on May 27, 2024

Tracking fix, will land in v14: #1424

Older versions like 13.0.0-beta.38 are affected as well

from flex-layout.

rajeshfavour avatar rajeshfavour commented on May 27, 2024

Older versions like 11.0.0-beta.33 are affected as well

from flex-layout.

angular-automatic-lock-bot avatar angular-automatic-lock-bot commented on May 27, 2024

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

from flex-layout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.