4 ms·
That sounds extremely cumbersome. Sometimes I just want to throw an any on something and call a method on it without having to deal with types. How would unknow
by Kiro 4y ago
That sounds extremely cumbersome. Sometimes I just want to throw an any on something and call a method on it without having to deal with types. How would unknown help with that? I can't call a method on a variable with unknown type.
- haburka 4y agoYou can use ‘as’ to cast unknown to any type. This is extra typing but it does signify to other developers that you’re calling a function on an unverified object, which I believe makes the code more maintainable in the long run.
- anentropic 4y agoWhy bother using typescript then?
- Kiro 4y agoThat 1% won't invalidate the remaining 99%.