Remix.run Logo
umanwizard 14 hours ago

> Typescript has this same problem

Don’t most languages have the same problem? Even C or Rust have escape hatches that let you override compile-time type checking and pass whatever gibberish you want to a function. How is Typescript any worse?

b_e_n_t_o_n 14 hours ago | parent [-]

node main.js just runs the code. you could simply not run tsc, which plenty of people do. can you ignore all type errors in Rust?

IshKebab 12 hours ago | parent | next [-]

You can ignore the borrow checker at least by using mrustc. And some type checks at least could be optional. The fact that they aren't isn't really a fundamental property of Rust, it's just because it's easy to make them not optional.

In my experience nobody writes Typescript without checking the types. Unlike Python for example where it's not uncommon to have broken types. (And it's way more of a mess in general.)

umanwizard 11 hours ago | parent | prev | next [-]

If you don’t run tsc you are not really using typescript.

nevir 14 hours ago | parent | prev | next [-]

The Rust equivalent is more like using `unsafe` and derefing raw pointers

b_e_n_t_o_n 14 hours ago | parent [-]

Yeah and you can explicitly assert a null is a string in TS, but it's explicit. You can't build a Rust program without those asserts but it's trivial to skip the type checking for TS which is more of a linter than a type system.

chamomeal 14 hours ago | parent [-]

I disagree that TS is more of a linter. But I definitely feel sympathetic to that perspective.

I’ll pull off the cleanest, nicest generic constraints on some component that infers everything perfectly and doesn’t allow invalid inputs, just for a coworker to throw @ts-nocheck on the entire file. It hurts

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