chore: updated types to def and changed deleted many as a new indexed type

This commit is contained in:
ankitsridhar16
2023-01-20 16:12:45 +05:30
parent 298b960ef7
commit 6da85fd286
2 changed files with 6 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ import { default as Redis, RedisOptions } from 'ioredis';
import { RedisPubSub } from 'graphql-redis-subscriptions';
import { PubSub as LocalPubSub } from 'graphql-subscriptions';
import { MessageType } from './subscriptionTopicsDefs';
import { TopicDef } from './subscriptionTopicsDefs';
/**
* RedisPubSub uses JSON parsing for back and forth conversion, which loses Date objects, hence this reviver brings them back
@@ -71,10 +71,7 @@ export class PubSubService implements OnModuleInit {
return this.pubsub.asyncIterator(topic, options);
}
async publish<T extends keyof MessageType>(
topic: T,
payload: MessageType[T],
) {
async publish<T extends keyof TopicDef>(topic: T, payload: TopicDef[T]) {
await this.pubsub.publish(topic, payload);
}
}