jgraph / drawio

draw.io is a JavaScript, client-side editor for general diagramming.
https://www.drawio.com
Other
41.19k stars 7.65k forks source link

Use TypeScript to implement jgraph/drawio #3322

Closed gonzojive closed 1 year ago

gonzojive commented 1 year ago

Is your feature request related to a problem? Please describe. Not a direct problem with the product, no. However, I have less trust in the codebase as a library user.

Describe the solution you'd like Start using TypeScript in the implementation of drawio instead of JavaScript. Eventually, convert everything to TypeScript.

People have written extensively about the advantages of TypeScript. In short, code quality goes up and so does developer velocity.

davidjgraph commented 1 year ago

We're not going to rewrite this Typescript. You're welcome to fork it and do so. We'll just have to live with our low developer velocity...

gonzojive commented 1 year ago

No criticism intended. Can you say more about the language choice?

No full rewrite is required either. Typescript can exist right alongside JavaScript, and AFAIK JavaScript is legal TypeScript (if strict type checking is off).

On Sat, Jan 28, 2023, 8:19 AM David Benson @.***> wrote:

Closed #3322 https://github.com/jgraph/drawio/issues/3322 as completed.

— Reply to this email directly, view it on GitHub https://github.com/jgraph/drawio/issues/3322#event-8380017293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUO57ZMDO24MBBIW73DXTWUVBKRANCNFSM6AAAAAAUJW2HTE . You are receiving this because you authored the thread.Message ID: @.***>

davidjgraph commented 1 year ago

No insult taken. We started this in 2005, vanilla JS was the only option.

Note in the README that only the core team can write to the project. It's probably fair to say we're a bunch of dinosaurs and JS works for us. TS wrappers would be possible as another project, but there's no way anyone would be able to keep up with the rate of change of signatures.

This project isn't designed to be used as a library, though. There exist libs (with TS) that might fit your needs better from a dev stand-point (note we started this as a library, mxgraph, and people have done TS wrappers for that. As an app the argument is weaker):

https://github.com/tldraw/tldraw https://github.com/excalidraw/excalidraw

You could also look at the community fork of the old library, https://github.com/maxGraph/maxGraph

gonzojive commented 1 year ago

Makes sense. Also, thanks so much for the library tips. I will look into those. My use case is making an electrical circuit schematic editing widget that plugs into a custom backend. Lots of customization needed, but at the same time it'd be nice to make use of all the nuanced editing interactions you have probably perfected over 17 years.

Yeah, I noticed the "no contributions" policy, and that makes sense. You all are generous for releasing this as FOSS, which is the opposite of a "dinosaur" move.

If you're interested in a "TypeScript conversion" case study, you can take a look at https://github.com/gTile/gTile/issues/93 where my TypeScript/Bazel fork was eventually merged into the main project. I'm not sure if contributions went up and bugs went down or not. That project is also an application, not a library. As a dev, I felt like autocomplete got better, and I had more confidence my changes were not breaking things.

lastlink commented 4 months ago

@gonzojive I pulled my drawio typescript interfaces from the drawio vscode plugin source code and added missing ones for only the parts I was using. You can checkout https://github.com/funktechno/sqltooling-drawio/blob/main/src/types/drawio-types.d.ts.