Remix.run Logo
Vinnl 7 hours ago

An important feature of TypeScript is identifying problems in your code before the user runs it, i.e. before a browser even comes into play.

array_key_first 6 hours ago | parent | next [-]

No runtime type safety bites people often and in unexpected ways. It should just be standardized.

Vinnl 5 hours ago | parent [-]

Sure, but that's an orthogonal concern. That sounds more like a call to standardise Zod.

lelanthran 6 hours ago | parent | prev [-]

So? If supported natively by the browser the browser could compile it on download.

You'll still get all the strong typing without have to wait for it to run.

For example an error in a little used branch would cause an error before the branch even runs.

Vinnl 5 hours ago | parent | next [-]

So then the user gets a type error in their face instead of the page loading? That doesn't really sound better than the developer getting that error while writing the code, which is what TypeScript currently does.

lelanthran 2 hours ago | parent | next [-]

> So then the user gets a type error in their face instead of the page loading?

The alternative is not "User sees no error", it's "user sees the error at runtime".

In which case, yeah, having the user see the type error is vastly preferable to having the user see a runtime JS error.

zdragnar 5 hours ago | parent | prev [-]

Not to mention the penalty of the browser having to re-execute the type checking every time the files aren't loaded from cache.

6 hours ago | parent | prev [-]
[deleted]