sibiraj-s / ngx-editor

🖋️ Rich Text Editor for angular using ProseMirror
https://sibiraj-s.github.io/ngx-editor/
MIT License
423 stars 182 forks source link

[Bug]: recurring error after updating to angular 15: ngx-editor Property 'pmViewDesc' must be of type 'ViewDesc', but here has type 'ViewDesc' #469

Closed Fiehra closed 10 months ago

Fiehra commented 1 year ago

What happened?

after updating my projects angular version to v15 the build keeps crashing. it is caused by a package which is used by ngx-editor (prosemirror-view). when checking resolved issues to see if maybe someone experienced the same issue i found a ticket with the exact same error message but in angular version 13. i updated ngx-editor to latest version (currently v15.3.0) to see if it will fix the error as proposed in the ticket, but the build keeps crashing. we cant use this build in our project if this persists. has anyone else experienced this error aswell? any pointers to fixing the build are much appreciated!

Version

v15.3.0

Angular Version

v15.2.8

What browsers are you seeing the problem on?

No response

Link to reproduce

No response

Relevant log output

Error: node_modules/prosemirror-view/dist/index.d.ts:215:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'pmViewDesc' must be of type 'ViewDesc', but here has type 'ViewDesc'.

215         pmViewDesc?: ViewDesc;
            ~~~~~~~~~~

  node_modules/prosemirror-state/node_modules/prosemirror-view/dist/index.d.ts:215:9
    215         pmViewDesc?: ViewDesc;
                ~~~~~~~~~~
    'pmViewDesc' was also declared here.

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

✖ Failed to compile.

Willing to submit a PR?

None

jmbarbier commented 1 year ago

I added those resolutions to package.json (same as ngx-editor devDependencies), cleared node_modules, yarn.lock or package-lock.json. The build works, but the downside is to remember updating those resolutions in sync with ngx-editor evolutions.

"resolutions": {
    "prosemirror-codemirror-6": "^1.0.0",
    "prosemirror-commands": "^1.5.0",
    "prosemirror-history": "^1.3.0",
    "prosemirror-inputrules": "^1.2.0",
    "prosemirror-keymap": "^1.2.1",
    "prosemirror-model": "^1.19.0",
    "prosemirror-schema-list": "^1.2.2",
    "prosemirror-state": "^1.4.2",
    "prosemirror-view": "^1.30.1"
  }
sibiraj-s commented 1 year ago

Sorry for the delay in response.

I believe there is no need to use resolutions. Just deleting the node_modules and package-lock.json and reinstalling should do. And, you should check the typescript version required(minimum).

Also, this is not with the library itself, it is because of some conflicting package version or with typescript mismatch during upgrades.

jakyle commented 1 year ago

image Hello! I'm also running into the same issue in ngx-editor@13.0.0

"typescript": "4.5.2"
"@angular/cdk": "13.3.2",
"@angular/common": "13.2.0",
"@angular/compiler": "13.2.0",
"@angular/core": "13.2.0",
"@angular/forms": "13.2.0",
"@angular/material": "13.3.2",
"@angular/platform-browser": "13.2.0",
"@angular/platform-browser-dynamic": "13.2.0",

I also deleted my yarn.lock, removed my node_modules and completely reinstalled the package, still no good.

sibiraj-s commented 10 months ago

Sorry I missed this. You must also check the tsconfig.json configuration. You can refer the project setup for any, this happens mostly after an update I guess. There isn't much I could do here as there is no bug in the editor.

Some things to check

these should resolve the issue. You can refer the code in this repo in projects/demo folder its already working.

Closing this as I couldn't do much here. This problem occurred for several people in the past, the above solution worked for everyone. Hope that solves your issue too.

Thanks.

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.