this post was submitted on 30 Sep 2023
109 points (91.0% liked)

Programming

17000 readers
253 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 11 months ago (1 children)

Typescript. Its pretty good and feature compleate overall, but has by far the most flexible typesystem.

[–] spikespaz 5 points 11 months ago (1 children)

It has by far the most broken type system which is basically a facade for the programmer to feel safe

[–] [email protected] 5 points 11 months ago* (last edited 11 months ago) (1 children)

Yes, the fact that we can mutate lists with anything is super scary: Here is a basic example.

[–] [email protected] 1 points 11 months ago* (last edited 11 months ago)

On one hand, this is definitely a gap, on the other hand, you are very unlikely to run into it in practice.

The whole "pass an array/object into some function that will mutate it for you" pattern is not very popular in JS , you are much more likely to encounter code that just gives you a new array as a return value and treats its arguments as read-only.

If you validate your data at the boundaries where it enters your system (e.g. incoming JSON from HTTP responses), TypeScript is plenty good enough for almost all practical uses.