slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
43.52k stars 3.38k forks source link

Type error in emitter.d.ts #3930

Closed pablopla closed 9 months ago

pablopla commented 10 months ago

I'm getting an error when trying to build Quill2.0-beta.0 with an Angular 17 project using Webpack or esbuild:

Actual behavior:

Error: node_modules/quill/core/emitter.d.ts:23:5 - error TS2416: Property 'listeners' in type 'Emitter' is not assignable to the same property in base type 'EventEmitter<string, any>'.
  Type 'Record<string, { node: Node; handler: Function; }[]>' is not assignable to type '<T extends string>(event: T) => ((...args: any[]) => void)[]'.
    Type 'Record<string, { node: Node; handler: Function; }[]>' provides no match for the signature '<T extends string>(event: T): ((...args: any[]) => void)[]'.

23     listeners: Record<string, {

Platforms: Webpack or esbuild

Version: v2.0.0-beta.0

ThanosAlmighty commented 10 months ago

I am also affected by this issue. I figured it might be an issue with versioning, but I was able to confirm that I was on the same typescript and angular.

jitterbox commented 9 months ago

I forked and briefly looked at a fix for this... the choice of the listeners property name is intentional, but I can't speak to why... it doesn't seem to be used outside of your Emitter class. Could the resolution be as simple as refactoring listeners to domListeners or similar @jhchen?

image

luin commented 9 months ago

@jitterbox Good catch! It makes sense to change it to a different property name.