paed01/bpmn-engine

Migrate to TypeScript

Closed this issue · 4 comments

Thank you @paed01 for developing this BPMN workflow engine! I'm using it inside NestJS + Nx project.

I propose to reconsider previous requests in #35, #81, and which has been implemented as #112 and further updates.

If accepted, I volunteer to do the TypeScript migration, so initial effort is on me. Some concerns & solutions:

  1. Will it be hard to modify the project afterwards?

    A: If you don't like coding in TypeScript, you can still code in JavaScript and make TypeScript compiler not complain by using any. This way, you retain how you like doing coding, while still bringing the benefits to TypeScript users.

  2. What are the benefits of migrating to TypeScript for me as project owner?

    A: As in first question, you can still do in JavaScript if you want. The benefits are no more sync-ing between TypeScript definitions and the project source code. All updates are always reflected because it's compiled by TypeScript. Even if some types are still any, it still brings benefits as users know the parameter names.

Thank you for your proposal.

I guess you have to migrate bpmn-elements and smqp as well? TS-migrations have a tendency to have repercussion on all dependencies.

IMHO I don't see the benefit of using TS as opposed to JS, though I recognise the need for TS-users. Feel free to fork/clone the project and publish it under a different name.

Thanks for giving feedback about this @paed01.

I guess you have to migrate bpmn-elements and smqp as well? TS-migrations have a tendency to have repercussion on all dependencies.

This isn't a rebuttal, but that's a common misconception. In my experience using TypeScript, I have yet to find a scenario where migrating one project results in another (dependency) project having to be TypeScript as well (and vice versa). Just as my NestJS project does not require bpmn-engine to be in TypeScript.

(Fun fact: Going further, it's actually even possible to mix JavaScript and TypeScript in the same project, which is useful during migration of a large project, but most people generally wouldn't recommend this.)

So the answer is, it's possible (and still convenient) for bpmn-engine to be TypeScript while bpmn-elements and smqp are still in JavaScript.

I don't want to maintain my own fork of bpmn-engine, but I'd love to contribute to bpmn-engine proper while still not forcing you as the project owner to do things you don't like. I believe it's possible.

Sorry to disappoint you but I won't migrate to TS in the near future. As stated in previously the engine is basically a wrapper of bpmn-elements, bpmn-moddle, and moddle-context-serializer. Most of the tests written in the engine are actually covered in bpmn-elements. So to implement your own TS BPMN engine shouldn't be that hard if you use the same deps. Probably you can do one better than me.

Alright @paed01 I'll be content with existing TypeScript definitions then.