4 ms·
Almost every language has some way to do stupid things. Say you're working in C# - you can forcefully cast almost anything to almost anything else, just like in
by Timon3 1y ago
Almost every language has some way to do stupid things. Say you're working in C# - you can forcefully cast almost anything to almost anything else, just like in TS. So according to you, C# is just as bad as TS in this respect, right?
- yencabulator 1y agoIf that's a thing commonly needed for basic operations like letting your event handler actually access the event details, then very much yes. Sane languages have a downcast mechanism that doesn't pretend it succeeds every time.
- Timon3 1y agoWeird, I don't need to do that. Also weird that Typescript has exactly the mechanism you're talking about. Why are you acting like it doesn't?
- neonsunset 1y agoYou can only do this with `unsafe { }` or `Unsafe.As/.BitCast`. Casts from/to `object` are type-safe even though may not be very user-friendly or good use of the type system in general.