Advanced Typescript problem
24 February 2024TypeScript is a strange beast. It helps achieve type safety, but at a certain point, it stops being helpful and instead complicates things a lot.
First of all, I don't know any engineer who is a real expert in Typescript that can do whatever they want with it. Everyone knows it only to certain degree and applies to the certain extent. Not as infrequent as desired, Typescript 'coverage' takes more time to complete than actually writing functional Javascript.
In fact Typescript is so powerful that you can do the metaprogramming with it, so the real question is how precise you want to be with the types. And it seems there is no finish line. You can go on forever in describing all intricate details of the logic of your code.
When the code is really complicated and messing with third-party libraries it becomes really hard to cover it with Typescript in full. At this point how can you be sure that everything is bulletproof? If not so sure then what is the point of it all? The basic cases are covered, but complex logic remains a black box because nobody has that needed level of Typescript to close all the gaps.
The most complex code that would benefit the most from Typescript is often left uncovered and with simplified types or even any
s instead.
C'est la vie!