|
|
|
Half my dev time fighting TS types
|
|
6 points
by koolyy
445 days ago
|
|
I'm a swe at a yc startup that uses the T3 stack (next, trpc, prisma) and I'm spending ~half of my dev time fighting typescript types. Updates require type changes across multiple files - most of which are unrelated to the feature I'm adding. Are we just using ts wrong? ts is newer to me - I was in laravel and dotnet before with very structured dto's and almost never had to touch types unless there was db changes. I get that functional programming is meant for small single use functions that define only the type of the object that it needs, but in my opinion, thats lead to a mess of types across the codebase and I miss the structured dto's being defined in one place and thats the type that gets passed everywhere. I'm not naive so I know I'm not the first dev to encounter these issues w ts so could someone tell me if we're just not using it correctly? I know we could define dto's in ts I'm just not sure if thats defeating the functional purpose. Does anyone else feel like they are spending way too much time wrestling types? |
|
Yes, managing types does take more work up front than _not_ having types... but the overall result should be that you benefit from them significantly by having fewer runtime bugs, and an easier time maintaining and understanding the code.