Re:Show HN: A SQL database implemented purely in TypeScript ...
by flowerlad on Monday September 28, 2020 @11:01AM
(#24617351)
This shows how complex TypeSript has become. It may be fun to write complicated Type annotations such as this, but imagine having to read and maintain the code!
[ Parent
| on HN ]
Re:Show HN: A SQL database implemented purely in TypeScript ...
by smt88 on Monday September 28, 2020 @01:19PM
(#24618990)
From years of real-world experience, it's rare to run into types that are too complex to easily understand. The syntax is pretty easy to read, and the compiler and language service make it easy to navigate types, even if you haven't looked at the source for them yet.
Re:Show HN: A SQL database implemented purely in TypeScript ...
by alangpierce on Monday September 28, 2020 @02:51PM
(#24620015)
FWIW I find that TypeScript types can sometimes be overwhelming or hard to decipher, especially some third-party library type definitions. The connect function from react-redux is one example:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d07d...
Since types can get really complex, I feel a need to be conscious of avoiding complexity when writing types myself, unless the value is enough to justify a hard-to-read type.
Re:Show HN: A SQL database implemented purely in TypeScript ...
by freeqaz on Monday September 28, 2020 @04:14PM
(#24620781)
This is the complexity introduced when applying static types to a vanilla JS codebase, imo. It's easy to get crazy with types in vanilla JS. Adding Typescript forces you to resolve the different types explicitly and it can get hairy.
What this really demonstrates to me is the difference between starting with TS vs migrating to it. Code that has to think about the types the first time it is being built is going to be better structured, on average, than purely dynamic code.
Re:Show HN: A SQL database implemented purely in TypeScript ...
by eyelidlessness on Wednesday September 30, 2020 @11:58AM
(#24640128)
Many complex/difficult to understand TS types exist precisely because the type system was too limited to express certain real world use cases without workarounds. As the type system takes on that complexity, and removes more limitations, it actually makes writing simpler types for those cases much easier.
Re:Show HN: A SQL database implemented purely in TypeScript ...
by bhandziuk on Tuesday September 29, 2020 @03:11PM
(#24631727)
I find these types still exist in JS it's just impossible to decipher what you're writing and supposed to be doing without a solid TypeSystem. The types might look complicated but really this is much more simplified that getting runtime errors.
Re:Show HN: A SQL database implemented purely in TypeScript ...
by searchableguy on Tuesday September 29, 2020 @04:22AM
(#24625288)
From ts conf talks, only a minority of people actually write most of the complex types. Those are mainly library authors and such, I presume.
https://youtu.be/jmPZztKIFf4 at 49:50.