4 ms·
The thing I have found the most useful with typescript is that it punishes you for doing the kind of cutesy stuff that permeated the node ecosystem in the early
by tengbretson 6y ago
The thing I have found the most useful with typescript is that it punishes you for doing the kind of cutesy stuff that permeated the node ecosystem in the early days.
"Pass in three parameters with a callback in the fourth position. The second param is configuration so pass in a string, but if you need to really customize stuff actually pass in an object instead and by the way if you don't have a third parameter then just chuck the callback there, why not!?"
Typescript is great in that somehow it is technically possible to write types for existing code written like this, but writing new code like that is cumbersome enough to prevent it.
- pragmatic 6y agoActually, you can "type" that call. But I always found the "giant ball if config" style painful. For example, I believe it was done data table library that took over a page of config options to get set up. The problem is, you'd have to have the documentation open to make the slightest tweak to anything. No help from the type system.
- Rapzid 6y agoYes! My pet peeve with public APIs are DTOs that are like this! "This is an array of strings, but it could be an object. If it's an object it will have this key and based on the name of the key it's this type. But it could also have or not have this other key and..." ARghhhh! You can tell what kinda language the back-end was written in with that crap because while TypeScript can actually type most of that stuff it's a huge mess in something like C#, Golang, Java, etc.