reedsy / quill-cursors

A multi cursor module for Quill text editor.
MIT License
248 stars 54 forks source link

Add typings #22

Closed NULLx76 closed 4 years ago

NULLx76 commented 5 years ago

It would be great if the types were also generated upon build and added to the dist so that when using the plugin with TS people can make use of the typings

alecgibson commented 5 years ago

I've had a very quick look at this, but getting the TypeScript definitions to play nicely with Webpack appears to be non-trivial. I've tried the following with no success:

I think this isn't working because we use default exports, which don't work very well when being combined into a single d.ts file. We could potentially move away from that, but it would be a breaking change, so I'd be inclined to leave it for if we want to make more big changes.

I probably don't have a lot of time to look into this, as it's a nice-to-have. Please feel free to raise a PR if you think you can crack it, though.

RobbinBaauw commented 5 years ago

A trivial but ugly solution (until it is possible to move away from default exports) would be making a definition file by hand. As there are not that many methods this should be very easy and quick. Thoughts on that?

alecgibson commented 5 years ago

Making one by hand is a bit icky in my opinion. I think I'd rather remove our default exports. I guess it's arguable that it's not a breaking change, because consumers shouldn't really have been trying to use anything other than the single point of entry into the module, and so long a that stays consistent, then it's fine. Or we just bump to v3 anyway. I guess it doesn't matter too much.

pedrosanta commented 5 years ago

Or we just bump to v3 anyway. I guess it doesn't matter too much.

Yeap. If it can be breaking better to bump, IMO.

alecgibson commented 4 years ago

Should now hopefully be fixed by https://github.com/reedsy/quill-cursors/pull/54

Release coming soon.

vlazh commented 4 years ago

@alecgibson, can't wait for release!