▲ | sdfhbdf 5 days ago | |||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript never promised improving safety, maybe it’s a common misconception. But TypeScript has no runtime mode or information. You were always at the mercy of running and not ignoring the typechecker. Nothing stopped you from running ts-node or tsx on code with egregious type errors. TypeScript is more like a linter in that regard. | ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | MrJohz 5 days ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
I think it's not fair to say that Typescript isn't about improving safety, just that the mechanism isn't the same as with other languages. Typescript had always allowed you to ignore the type checker (in fact, the default configuration will always attempt to emit compiled Javascript, even if the source Typescript has type errors). But if you run the type checker on every commit (via e.g. CI or a precommit hook), then you can be sure that the code you release is correctly typed, which will not guarantee it is safe, but makes it more likely. I agree that it's better to think of Typescript as a linter that needs specialised annotations to work, rather than a type system like you might find in Java or Rust. | ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | tempodox 4 days ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
> TypeScript never promised improving safety What, pray tell, would be the point of putting all that type information in there, and then have it checked (via tsc), if not for the sake of safety? What other use would this have in your opinion? | ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | tkzed49 5 days ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
> TypeScript is more like a linter that's exactly the point--GP is pointing out that node can't do that part | ||||||||||||||||||||||||||||||||||||||||||||||||||
|