Khan / genqlient

a truly type-safe Go GraphQL client
MIT License
1.09k stars 112 forks source link

Use generics for subscriptions responses #356

Open HaraldNordgren opened 2 months ago

HaraldNordgren commented 1 month ago

@benjaminjkraft Thanks a lot for your feedback! I have thought about this a lot, and I think you are absolutely right. Introducing generics on the client layer like I did, would worsen the user experience. So it's not worth doing.

I will reduce the scope of this PR and still see if I find any useful refactor using generics 🤗

HaraldNordgren commented 1 month ago

Hi @benjaminjkraft, I landed on this quite minimal refactor in the end. Let me know if you think it's useful or not.

I could also be fine with throwing this away. My real goal was to avoid the type casting of interfaceChan but I couldn't figure out a way to do it without making the library harder to use, which definitely would have been a bad thing.