diff --git a/index.d.ts b/index.d.ts index 13396202..efccf214 100644 --- a/index.d.ts +++ b/index.d.ts @@ -23,9 +23,20 @@ import { Readable } from 'stream' type Mercurius = typeof mercurius declare namespace mercurius { - export interface PubSub { - subscribe(topics: string | string[]): Promise>; - publish(event: { topic: string; payload: TResult }, callback?: () => void): void; + export type PubSubPublishArgsByKey = { + [key: string]: any; + }; + + export interface PubSub< + TPubSubPublishArgsByKey extends PubSubPublishArgsByKey, + > { + subscribe>( + topics: TKey | TKey[], + ): Promise>; + publish>( + event: { topic: TKey; payload: TPubSubPublishArgsByKey[TKey] }, + callback?: () => void, + ): void; } export interface MercuriusContext { diff --git a/package.json b/package.json index b214dca9..58568ddb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mercurius", - "version": "14.1.0", + "version": "15.0.0", "description": "Fastify GraphQL adapter with subscription support", "main": "index.js", "types": "index.d.ts",