graphql-redis-subscriptions
graphql-redis-subscriptions copied to clipboard
types: allow specifiying enums for allowed triggers
This makes it possible to do something like:
export enum SubscriptionsTopics {
A,
B,
};
const redis = new IORedis();
export const graphqlPubsub = new RedisPubSub<SubscriptionsTopics>({
publisher: redis,
subscriber: redis,
});
Hey @rohit-gohri Thanks for the contribution!
I wouldn't mind merging that but please make sure that CI is passing. At the moment it seems like that typescript compile is breaking.
Also, if you don't mind, please add a section to the README that demonstrates how this can be used for TS users.
Hi @davidyaha, sure. I'm still figuring out what the best way to do this would be, was trying to also enforce the types of the payload through a payloadmap type. But couldn't get that working properly.
I guess, I'll leave that part for another PR and just template the topics for now.