Samuel
@samuel.fm
it’s a type assertion
1 1Actually nevermind, that is super useful. 😱
1 2Yes, very useful, but also often an indicator that someone is just working around the type system and writing unsafe code. It's often better to assert types with "as blah" or use type narrowing or whatever. We've been hit multiple times with people using this and ending up with exceptions in prod!
1 1Thanks for the tip. In that case, it makes me wonder if this should be something that should be optionally flagged as a warning, but I haven't written any code with it, so I don't know if there is code where it is the best option. I.e. discourage features that do more harm than good.
1Yeah it's definitely a potential footgun and it's worth thinking about why it's being used if you end up using it.