Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I feel you and I think it is more of a "React + TypeScript" problem than a TypeScript problem.

We have started using Angular 2 (now.. 6?) with TypeScript for a project last year and I never had big issues with TypeScript.

Last month, one of our teams started a React project and given the success of using TypeScript before, they opted to do the same with their project. I've walked them through a few things but found myself getting frustrated a lot with weird TypeScript errors. Especially things like typing your Props was such a nightmare that we resorted to "any" a lot more than I'd like.

The project is not using TypeScript 3 so I am unsure whether that would get rid of some problems but React + TypeScript was just a frustrating experience for us.



Using TS3 with ours and the problems are definitely still there.

I think the most immediate and obvious pain point for me is typing HOCs. It's basically a matter of rearranging how you apply them until TS can automatically infer a type for you. At the same time, using `compose` instead of applying them individually solves that problem but results in strange types (that are different from the type TS infers if you apply the HOCs manually yourself in an order that makes it happy) that I suspect will cause type errors down the road when we convert the files that make use of it to TS as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: