diff --git a/src/transports/ephemeral-transport.ts b/src/transports/ephemeral-transport.ts index 0b0c817..9cb2364 100644 --- a/src/transports/ephemeral-transport.ts +++ b/src/transports/ephemeral-transport.ts @@ -17,17 +17,17 @@ export class EphemeralTransport { return response; } - async receive(url: string, schema: T): Promise>; - async receive(url: string): Promise; - async receive(url: string, schema?: ZodType): Promise { + async receive(url: string, schema?: T): Promise> { const transport = await this.transports(url); const message = await transport.waitFor('message', () => true); transport.disconnect(); if (schema) { - return schema.parse(message); + // TODO: Figure out how the hell to fix this assertion. It shouldnt be needed, but TS is being a bitch. + return schema.parse(message) as T extends undefined ? unknown : output; } - return message; + // TODO: Figure out how the hell to fix this assertion. It shouldnt be needed, but TS is being a bitch. + return message as T extends undefined ? unknown : output; } }