|
|
|
|
|
by MFogleman
1936 days ago
|
|
This article echos the common complaint I've seen from people hesitant to adopt TS. "I always used to get some compilation errors which were hard to understand initially, and I scratched my head trying to figure out the problem. " Which is like saying,
"I got rid of my carbon monoxide detector because it kept beeping at me" |
|
One can write code that would work correctly, but trying to express the types as precisely as one would like may be painful and doesn't necessarily be productive.
Sometimes when I feel it is cumbersome to express my intent in typing, I may feel satisfied enough to make a runtime check, (and perhaps add a note but depends...). Especially if that functionality is used in scoped area (e.g. module) and not exposed to the rest of the app.
When trying to make a generic and flexible functionality, the typing experience seems get harder and more time-consuming for human to grok, and it may not even be that useful when you look how the code is used.
So I usually try to make typing as good as I can by finding documentation related to what I'm trying to do and banging my head to the wall from a couple of angles, and for some specific parts I may give up and type any.
Perhaps sometimes when typing feels hard it may tell that the abstraction is just plain wrong, so there's that plus side!