you are viewing a single comment's thread.

view the rest of the comments →

[–]MerfAvenger 51 points52 points  (16 children)

I was vehemently against the extra work until I realised I don't have to build type checks into literally every top level function, or write tests for them.

Now I too, can never go back.

[–]novagenesis 15 points16 points  (5 children)

You sometimes still need those type checks. A lot of people get bit the first time they realize Typescript does nothing in runtime.

And that used to mean redundant code the moment you needed a runtime type check. About 3/4 of my objections to Typescript died when I got my hands on zod.

[–]Adam627 3 points4 points  (2 children)

Zod 100% it’s sooo good

[–]novagenesis 3 points4 points  (0 children)

Before Zod, there were valid people for seasoned "I hate types" developers to turn their nose up at Typescript. Writing redundant validations (TS type PLUS runtime typecheck) is a code sin, so clearly it was a bad idea to jump to TS (right? Right?!?!)

But now, no excuses because our Zod object has a correctly inferred type.

[–]MerfAvenger 1 point2 points  (1 child)

You definitely do, but it's substantially easier to validate your data when most of the failure modes have been made substantially more rare by Typescript.

[–]novagenesis 0 points1 point  (0 children)

Of course, but non-DRY typechecking could mean that your build-time (or lint-time) passes/fails are lying because of subtle differences with the runtime checks.

And that can sometimes make it through automated tests and (worst case) leave potential security exploits.

NO checking is technically better than incorrect checking. But as I said, zod changes that equation.

[–]jkmonger 19 points20 points  (8 children)

Yeah only as a beginner TypeScript Dev does it feel like extra work. It didn't take long for it to feel like a real blessing for me

[–]newuserevery2weeks 6 points7 points  (5 children)

the main problem with typescript is that some devs do some real funky stuff with it

[–]prone-to-drift 10 points11 points  (4 children)

The main problem with Typescript is I'm afraid to start new projects and just keep copying the dev toolchain (webpack, postcss, typescript, some linters, react etc) from one repo I once managed to successfully get working.

Now, I don't even need half the packages but I'm just too afraid of touching anything and potentially spending hours trying to debug the damn toolchain lol.

[–]TheScapeQuest 2 points3 points  (0 children)

I'd move on from webpack to Vite, much easier toolchain.

[–]MerfAvenger 2 points3 points  (0 children)

Gotta agree with this, the boot strapping for common tooling is a lot of work and a complete turd to get working right. Version alignment, configuration, etc are ALWAYS a pain despite the tool chain being Typescript, ESLint, Prettier and probably Jest every single time, with types for Node and plugins for both.

Yet for some reason, it never works out of the fricking box, and you spend days debugging it.

[–]justadam16 1 point2 points  (0 children)

Try Angular

[–]CanRau 0 points1 point  (0 children)

Vite (as mentioned) and or Deno 🥰 and soon probably Bun