After using TypeScript there's some features that I'm terrified of that seem counter intuitive. All the following examples produce NO errors and are with every single strict TS option enabled.
-
-
As expressions are another one. The safety guarantees are minuscule. I find the overlapping semantics to be confusing and not actually useful.pic.twitter.com/SqqnJxRz5H
Show this thread -
Refining 'unknown' to an array produces 'Array<any>' where as 'Array<unknown>` would make more sense. Not sure if it does in other places too.pic.twitter.com/gsRa67JFFk
Show this thread
End of conversation
New conversation -
-
-
I use type predicates about as much as type casting: rarely. They’re both powerful yet unsafe. Occasionally you need to tell TS that you know better than the type system.
-
I have 12 uses of type predicates and 81 uses of "type casting". They would be even more powerful if they were safe.
- 4 more replies
New conversation -
-
-
Probably has trouble parsing those ligatures, like the rest of us ;)
-
If only it was that easy to fix ;)
End of conversation
New conversation -
-
-
You can write incorrect code. It can't be guaranteed to be correct or you couldn't do anything interesting. As opposed to flow where you either get stuck with any or it's just wrong
-
Of course the simple case can be checked. I can also write a simple program that can be reduced to a regular language. We can prove a lot about that program in this case. But I think we both know that's not the point of Turing completeness
- 2 more replies
New conversation -
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
The point of both type assertions and custom type guards is the compiler can't figure out the type and you have more information than the compiler. The only missing feature it'd argue is the case when people want to put some checks in utility functions.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 