100 ms·
> a TypeScript variable may in fact contain any value regardless of its declared type. That's true in pretty much all languages. Even in Haskell you can use `u
by wereHamster 9y ago
> a TypeScript variable may in fact contain any value regardless of its declared type.
That's true in pretty much all languages. Even in Haskell you can use `unsafeCoerce`. In Rust you have 'unsafe' blocks. And any language which has a FFI you can implement the type-safety-violating functions in the foreign language (often C).
- devit 9y agoYeah but in Rust and Haskell it's isolated to clearly marked code (except for some minor bugs in Rust that will be fixed - see https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3AI-unsound+is%3Aopen https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is... ). Instead TypeScript has a bunch of serious unfixed design flaws that make the problem pervasive, plus they refuse to fix them (see https://github.com/Microsoft/TypeScript/issues/9825 https://github.com/Microsoft/TypeScript/issues/9825 ).