sulu icon indicating copy to clipboard operation
sulu copied to clipboard

Switch from Flow JS to Typescript

Open alexander-schranz opened this issue 4 years ago • 2 comments

Problem description

The last years typescript got a lot popular than flow js and flow seems to be only used by handful of tools. For a better future support it would be good to convert from flow js to typescript.

Proposed solution

  • https://github.com/Khan/flow-to-ts
  • https://www.skovhus.dev/blog/flow-to-typescript-migration

As the tool is using prettier. A preperation task could be to switch for code styling in js from eslint to prettier. Still eslint will I think stay for none styling rules. But this switch need I think more discussed in deep.

alexander-schranz avatar Jan 13 '22 23:01 alexander-schranz

I only look at typescript as another coffeescript or flow language that one day will be obsolete when javascript gets better and better. in the next 5-10 years there will be another rust like language that overtake typescript javascript on the other hand is always here to stay and browser will never add typescript support.

You might not need TypeScript... (syntax) - you can have type safety without typescript flavored syntax

jimmywarting avatar Jul 04 '22 08:07 jimmywarting

We are using FlowJS for typesafety and will aslong as JS doesn't provide such things go with FlowJS and hopefully in future with Typescript. I know Typescript can be used with JSDocs instead of inline types (like in your link) but it is limited. Keep in mind this does have zero effect on people using Sulu. So it is more for us internal to have a better tested and static analyzed codebase.

People using Sulu will not be effected by this change a lot, we will maybe replace FlowJS but most custom JS isn't even using FlowJS it is just using vanilla JS and every team can continue using VanillaJS, they even can use FlowJS if we change to TypeScript when they add the correct babel transformer. So at the end for enduser there will not be much change for this. And every team can decide what they want to us.

Keep also in mind this only effecting Admin JS and has nothing todo with how you are setting up your JS on the website with Sulu. Sulu currently ships nothing for website and is open for any technology there and is currently not planned anything be changed there.

alexander-schranz avatar Jul 04 '22 09:07 alexander-schranz