3 ms·
I think there are certain types of boilerplate that used to be truly onerous that are now much less so because of types. If there are 3 different files that nee
by macrael 3y ago
I think there are certain types of boilerplate that used to be truly onerous that are now much less so because of types. If there are 3 different files that need to be updated to add a file, and forgetting one is only going to error at runtime (maybe even only if you're exercising that new field) that's horrible. But 3 files that require updating where the code won't compile until you've added all three is way way less of a problem.
- tlrobinson 3y ago> But 3 files that require updating where the code won't compile until you've added all three is way way less of a problem. I think this is only really possible in a relatively small subset of programming languages, even among those with static typing. At a minimum it seems like it would require a type system that didn't allow optional properties (by default) and did distinguish between nullable and non-nullable types. Unless I'm missing something. Would love to see some examples of this done right. Or at least examples of languages you've done this in.
- macrael 3y agoOptional types can get you for sure. I've been doing this with typescript and it's been alright. Prisma -> my domain model -> ApolloServer