re: TypeScript is a waste of time. Change my mind. VIEW POST

FULL DISCUSSION
 

The biggest benefit of using a statically typed language is runtime type checks. Sending data to a server and it throwing an error because you forgot to change your string to a number is awesome. No extra boilerplate to cast a type to something you can work with is great, you enforce your users to send the correct data and if that data changes, you instantly know where the problem is.

TypeScript can't do this. TS only checks types at compile time. This can be useful during development in some cases, but I really question the skills of a developer who's constantly creating type errors in development, where you'd have to rely on a compiler to tell you your mishaps.

I would absolutely use TS if it had runtime checks, but without them, I find coding in TS verbose for very little payoff.

 
 

The biggest benefit of using a statically typed language is runtime type checks.

Read it outloud. Runtime checks e.g. dynamic type checking.

const validate (x) => {
  const i = parseFloat(x);
  return !isNaN(i);
}

Dynamic type checks are possible in dynamically typed languages.

code of conduct - report abuse