2 ms·
What's bad about using clever types? My (limited) experience is that if they're done well they just work. I don't know why React-Query's types work the way they
by solarkraft 4y ago
What's bad about using clever types? My (limited) experience is that if they're done well they just work. I don't know why React-Query's types work the way they do, but I quite like that they do. Developing an intuition for it was a bit hard, but I believe this might rather be a failure of the documentation.
- wruza 4y agoAnd if they aren’t, good luck debugging it. I remember recently some typing issue in a webpack config where a correct key was marked as a type error in a presence of another construct, despite being documented and having an effect. Also try exploring npm/telegraf classes (auto-documented) by looking at their type definitions. The whole bot api could have been written as simple repeated definitions, but someone chose the clever way of multi-level type mutations and derivatives. Typescript will soon need secondary community-maintained type contracts that are human-readable and cross-checked with those in libraries. Something like @humane-types/*.