4 ms·
The last soundness issue I'm aware of is the bivariant function issue which they resolved in 2.6
by hath995 8y ago
The last soundness issue I'm aware of is the bivariant function issue which they resolved in 2.6
- jannes 8y agoYou can still do something like this: let x: number = "some string" as any;
- mschuetz 8y agoI don't get it, I though the whole purpose of typescript is to prevent things like that?
- hath995 8y agoThat's sort of tautological. "Any" and type assertions are designed as the escape hatch of the type system. If you're trying to develop type safe typescript you obviously won't use those. The followup question is for typed code (excluding usage of any or type assertions) does typescript have an unsound type system? Afaik the answer is no.
- jannes 8y agoIn the real world you are forced to use "any" when the type definitions for a third-party library are not perfect. This actually happens a lot with types from DefinitelyTyped that are not maintained by the original author of the library.
- Too 8y agoThat would be the equivalent of static_cast in c++, or casting via (object) in C#. Both of those are considered type safe but can still be abused also.