5 ms·
I don't agree with this - types do not imply abstractions, and simple types make simple code. Every tool has the potential to be misused in accidental complexi
by lucasyvas 3y ago
I don't agree with this - types do not imply abstractions, and simple types make simple code.
Every tool has the potential to be misused in accidental complexity.
- jakelazaroff 3y agoI don't know, man — I see a lot of TypeScript developers who lean hard into generics (I am occasionally one of them).
- mordae 3y agoBecause generics are actually a powerful tool for simplifying the data flow. They make it possible to promise not to do anything specific to and based on the data involved.
- sanitycheck 3y agoWhen I've seen this (and found myself doing it) it's been because we're trying to do something with TS which we would have done easily in JS. But the JS function we would have written would have required someone using it to read and understand it, and the TS function (without using 'any') needs to fully express what its inputs and outputs can look like. Because of this TS actually tends to guide me towards writing more "Grug brained" code, because I refuse to use 'any' (and throw away TS benefits) and using generics usually requires a trip downstairs for a fresh cup of tea.