Hacker News new | ask | show | jobs
by fastball 680 days ago
I wouldn't really say Typescript is enforceable, given that the types aren't actually considered at runtime.
3 comments

That is the case for most typesystem considered safe, save for introspection use cases. For instance, haskell, a language with strong type guarantees, does erase types for runtime.
In fact, people should see Typescript as a linter / bundler tool than a programming language by itself, ignoring the design mistakes of how enums and namespaces came to be.
Almost no languages have types considered at runtime.
Well python does, after the famous PEP to pack all types into strings got parked (probably forever).

There's packages to typecheck at runtime, even to check the parameters to a function.