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.
[ Parent
| on HN ]
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.