5 ms·
I feel like I'm the only one, but I don't care for Typescript. After working with it for a while, the type checker ends up being painful to work with. I'm usi
by wry_discontent 7y ago
I feel like I'm the only one, but I don't care for Typescript.
After working with it for a while, the type checker ends up being painful to work with. I'm using React, and it's difficult to write higher order components that are correctly typed. Additionally, probably related, styled components often get messed up with the type system.
- fendy3002 7y agoPersonally I prefer to not use typescript on react (I don't have any experience on it and it seems like a hassle). I use it on mobx / redux instead. However it's a godsend for nodejs.
- tomduncalf 7y agoIt’s not really a hassle at all and adds great value with compile time checking of proptypes etc. Give it a go. If you use MobX especially you should find it really quite straightforward - I’m not sure what typing Redux is like these days, didn’t used to be much fun but I’ve not used Redux for about 3 years
- steve_taylor 7y agoYou're not the only one. It's an absolute pain dealing with incorrect and incomplete type definitions and lack of TypeScript examples for libraries. If all libraries I used were built and documented using TypeScript, I'd probably use it.
- ncphillips 7y agoAll Typescript does is highlight how bad the Higher order Components pattern is. Don’t do it, use hooks or render props instead.
- abritinthebay 7y agoI used to be the same way and I found it came from overuse of types in some applications I worked on. I know the TypeScript working group at Netflix found the same thing. Generally it's best to let its type inference do as much work as possible and then add types to help it. Simple input and output types in functions can help a lot too. Too many types in TypeScript is, imo, a net negative to a project. It sounds counter-intuitive but has been borne out by practical use cases at multiple large companies that I've worked at.
- Humphrey 7y agoI agree in part. I've also had the type battle with HoC... and with Redux is still pretty painful. I don't know if this is Typescripts fault though, or more to do with some of js magic that goes on. But, once you win the battle... having typed redux and HoC works great!
- pimterry 7y agoIf you're struggling with TypeScript + React, check out the React TypeScript Cheatsheets: https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/ https://github.com/typescript-cheatsheets/react-typescript-c... There's even a specific one on how to type HOCs: https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/HOC.md https://github.com/typescript-cheatsheets/react-typescript-c...
- cryptica 7y agoYou're not the only one who believes this; you're just ahead of the curve. TypeScript adds negative value overall once you consider real use cases. Eventually everyone is going to have experienced issues with incompatible dependencies, outdated type definitions, incompatible TS version config settings, incompatibility issues with bundling tools, source mapping issues, monorepo issues, issues related to debugging in a deployment environment. I think that the biggest problem with TypeScript though is that it gives a false sense of high code quality which actually makes the real code quality and architecture a lot worse. With code completion and the ability to jump around the code very easily, TS makes it easy to keep track of classes and type definitions over many files without having to actually think about the class hierarchy or file and folder structure but this is a short term approach and leads to significant long term issues.