DEV Community

Discussion on: TypeScript or F#?!? WHICH IS BETTER?!

Collapse
 
szymonszym profile image
szymon-szym

Hi Jakub, nice post! I am in love with both TS and F#.
I would argue that in the nulls category F# is a clear winner. Not having nulls in the language is huge, and I believe that the whole point is to force developers to deal with None cases explicitly. In F# you can chain Options in the nice pipelines. In TS you would need to use library, e.g. fp-ts (which is amazing btw).
In my opinion, the huge advantage of TS is the ecosystem. Nowadays it is hard to find popular npm packages without types declaration (a big part of them is written in TS in the first place). Using those packages from TS code is seamless. On the other hand, most libraries in the .NET ecosystem were created in and for C#. Utilizing them in the F# feels rusty. You need to deal with nulls, mutable classes, and other "non-fsharpy" stuff.
As I said I love both languages. My default is F#, but I am pleased to go with TS if it makes more sense.

Collapse
 
svehla profile image
Jakub Švehla

Hello 👋 thanks for review!

I 100% understand your arguments and i feel it! I'm still not a sure if prefer one or the other approach. In my life a wrote a lot of TypeScript code and not all of it was super super-production-ready app which has to be without errors. So i belive that there is some ratio between productivity and safety. Because of that i really like that you're able to write some sh**y code where only success path is working and if you want you may do it type-safe. But if you want to do some POC as fast as possible you just put @ts-expect-error here and you're fine :D

I'll think about it more..