You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to improve the type definitions for Quill and have been running into this issue lately. There are quite a few places where something is typed as being Blot (from the interface) or BlotConstructor (an interface with new(): Blot). The largest issue with the Blot/BlotConstructor interface is that it requires defining static and instance properties/methods in different places. Instead you should be able to use the base Blot class ShadowBlot as a class, and where you need its constructor use typeof ShadowBlot.
The text was updated successfully, but these errors were encountered:
So typeof ShadowBlot is essentially the constructor function, but it will also have any statically declared properties present. If you take a look at the PR I submitted you'll see that it ends up working quite well.
If you look through the Advanced section of the typescript handbook classes can be used as interfaces. typeof SomeClass is also an interface with a new(): SomeClass declaration and all static properties of the class.
I've been trying to improve the type definitions for Quill and have been running into this issue lately. There are quite a few places where something is typed as being
Blot
(from the interface) orBlotConstructor
(an interface withnew(): Blot
). The largest issue with the Blot/BlotConstructor interface is that it requires defining static and instance properties/methods in different places. Instead you should be able to use the base Blot classShadowBlot
as a class, and where you need its constructor usetypeof ShadowBlot
.The text was updated successfully, but these errors were encountered: