KillerCodeMonkey / ngx-quill

Angular (>=2) components for the Quill Rich Text Editor
MIT License
1.79k stars 264 forks source link

Update to 26.0.3 generates error on `tsc` #1879

Closed KeithGillette closed 5 months ago

KeithGillette commented 5 months ago

Running tsc on a project updated to ngx-quill@^26.0.3 with quill@2.0.2 generates the following error:

node_modules/ngx-quill/lib/quill-editor.component.d.ts(55,80): error TS2694: Namespace '"/path/to/node_modules/parchment/dist/src/parchment"' has no exported member 'Registry'.
kzander91 commented 5 months ago

Same issue with 26.0.4. Downgrading to 26.0.2 fixes it for me.

KillerCodeMonkey commented 5 months ago

can you share your tsconfig please?

KeithGillette commented 5 months ago

Workspace tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "declaration": false,
    "downlevelIteration": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "lib": [
      "es2022",
      "dom"
    ],
    "module": "es2022",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "outDir": "./dist/out-tsc",
    "resolveJsonModule": true,
    "sourceMap": true,
    "strict": true,
    "strictNullChecks": false,
    "target": "es2022",
    "paths": {
      "@tasktrain/node": [
        "libraries/node/src/index.ts"
      ],
      "@tasktrain/shared": [
        "libraries/shared/src/index.ts"
      ]
    }
  }
}

Project tsconfig.json:

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../dist/out-tsc/app",
    "types": [],
    "target": "ES2022",
    "useDefineForClassFields": false
  },
  "angularCompilerOptions": {
    "enableIvy": true,
    "preserveWhitespaces": false,
    "fullTemplateTypeCheck": true,
    "strictTemplates": false,
    "strictInjectionParameters": true
  },
  "include": [
    "src/polyfills.ts",
    "src/main.ts",
    "src/app/**/*.ts"
  ]
}

Thanks!

KillerCodeMonkey commented 5 months ago

strange in my example repo everything is working. and when i check the typings it is there.

Its deployed there: https://killercodemonkey.github.io/ngx-quill-example/

KillerCodeMonkey commented 5 months ago

Screenshot_20240620_184246

KillerCodeMonkey commented 5 months ago

Can somebody please check if the correct parchment version is installed in the node_modules folder?

Do you specified parchment in your package.json with a different version?

KeithGillette commented 5 months ago

Here's my node_modules/parchment/dist/src/parchment.d.ts ( "version": "1.1.4") after deleting node_modules & fresh npm install:

import ContainerBlot from './blot/abstract/container';
import FormatBlot from './blot/abstract/format';
import LeafBlot from './blot/abstract/leaf';
import ScrollBlot from './blot/scroll';
import InlineBlot from './blot/inline';
import BlockBlot from './blot/block';
import EmbedBlot from './blot/embed';
import TextBlot from './blot/text';
import Attributor from './attributor/attributor';
import ClassAttributor from './attributor/class';
import StyleAttributor from './attributor/style';
import AttributorStore from './attributor/store';
import * as Registry from './registry';
declare let Parchment: {
    Scope: typeof Registry.Scope;
    create: typeof Registry.create;
    find: typeof Registry.find;
    query: typeof Registry.query;
    register: typeof Registry.register;
    Container: typeof ContainerBlot;
    Format: typeof FormatBlot;
    Leaf: typeof LeafBlot;
    Embed: typeof EmbedBlot;
    Scroll: typeof ScrollBlot;
    Block: typeof BlockBlot;
    Inline: typeof InlineBlot;
    Text: typeof TextBlot;
    Attributor: {
        Attribute: typeof Attributor;
        Class: typeof ClassAttributor;
        Style: typeof StyleAttributor;
        Store: typeof AttributorStore;
    };
};
export default Parchment;

Our project does not have parchment as an explicit dependency, just ngx-quill and quill.

KillerCodeMonkey commented 5 months ago

Can you check your nodes modules folder please for parchment and the typings, please ?

KillerCodeMonkey commented 5 months ago

i created a fresh new repo with just installing quill and ngx-quill.. an it is working for me.

https://github.com/KillerCodeMonkey/angular-18-ngx-quill-26.0.4

maybe one of you can check if this is working for you and where the differences are. In general the correct parchment should be installed in your node_modules folder when quill v2.x is installed and then the typings should be there

kzander91 commented 5 months ago

I'm using @types/quill. Without it, my error changes to

Error: node_modules/ngx-quill/lib/quill-editor.component.d.ts:55:67 - error TS2307: Cannot find module 'parchment' or its corresponding type declarations.

55     readonly registry: import("@angular/core").InputSignal<import("parchment").Registry>;
                                                                     ~~~~~~~~~~~

I can build your example app successfully, the versions of Angular, ngx-quill, quill and parchment are the same as in my project.

There are other differences though, trying to figure out which of these may be the problem will take some more time.

KillerCodeMonkey commented 5 months ago

So in general types/quill should not be needed anymore.

Am 20. Juni 2024 19:52:46 MESZ schrieb Kai Zander @.***>:

I'm using @.***/quill`. Without it, my error changes to

Error: node_modules/ngx-quill/lib/quill-editor.component.d.ts:55:67 - error TS2307: Cannot find module 'parchment' or its corresponding type declarations.

55     readonly registry: ***@***.***/core").InputSignal<import("parchment").Registry>;
                                                                    ~~~~~~~~~~~

I can build your example app successfully, the versions of Angular, ngx-quill, quill and parchment are the same that fail in my project...

There are other differences, trying to figure out which of these may be the problem will take some more time.

-- Reply to this email directly or view it on GitHub: https://github.com/KillerCodeMonkey/ngx-quill/issues/1879#issuecomment-2181230822 You are receiving this because you commented.

Message ID: @.***>

kzander91 commented 5 months ago

I got it working now, there was a weird issue with @types/quill and an old version of parchment being a dev-only transitive dependency. With ngx-quill 26.0.2 and @types/quill currently being installed, I did:

npm r @types/quill && npm i ngx-quill@26.0.4 && npm i parchment@3.0.0 && npm r parchment

And now it's working.

KeithGillette commented 5 months ago

We removed @types/quill when we upgraded to Quill 2, so that's not the source of our problem. It appears that our use of quill-emoji@0.2.1 is the issue:

npm ls parchment
├─┬ quill-emoji@0.2.1 (git+ssh://git@github.com/artknight/quill-emoji.git#bfff17cbb82c4ce2bb974eb657013c7133ae85fa)
│ └── parchment@1.1.4
└─┬ quill@2.0.2
  └── parchment@3.0.0
KillerCodeMonkey commented 5 months ago

Nice

Am 20. Juni 2024 21:13:04 MESZ schrieb Kai Zander @.***>:

I got it working now, there was a weird issue with @./quilland an old version ofparchmentbeing a dev-only transitive dependency. Withngx-quill` 26.0.2 and @./quill` currently being installed, I did:

npm r @types/quill && npm i ***@***.*** && npm i ***@***.*** && npm r parchment

And now it's working.

-- Reply to this email directly or view it on GitHub: https://github.com/KillerCodeMonkey/ngx-quill/issues/1879#issuecomment-2181360835 You are receiving this because you commented.

Message ID: @.***>

KillerCodeMonkey commented 5 months ago

If I remember correctly. Quill emoji does not support quill v2?

Am 20. Juni 2024 21:14:14 MESZ schrieb Keith Gillette @.***>:

We removed @./quill` when we upgraded to Quill 2, so that's not the source of our problem. It appears that our use of @.` is the issue:

npm ls parchment
├─┬ ***@***.*** ***@***.***/artknight/quill-emoji.git#bfff17cbb82c4ce2bb974eb657013c7133ae85fa)
│ └── ***@***.***
└─┬ ***@***.*** invalid: "2.0.1" from the root project
 └── ***@***.***

-- Reply to this email directly or view it on GitHub: https://github.com/KillerCodeMonkey/ngx-quill/issues/1879#issuecomment-2181362452 You are receiving this because you commented.

Message ID: @.***>

KeithGillette commented 5 months ago

We're using a fork of quill-emoji updated for Quill 2. Its package.json is set to "parchment": "*", so I'm not sure why it's pulling parchment@1.1.4.

KeithGillette commented 5 months ago

@kzander91's trick of npm i parchment@3.0.0 && npm r parchment updated package-lock.json and resolved the issue, allowing update to ngx-quill@26.0.4. 🎉 Thanks for your responsiveness, @KillerCodeMonkey!