Remove the overloads in epheraml transport
This commit is contained in:
@@ -17,17 +17,17 @@ export class EphemeralTransport {
|
||||
return response;
|
||||
}
|
||||
|
||||
async receive<T extends ZodType>(url: string, schema: T): Promise<output<T>>;
|
||||
async receive(url: string): Promise<unknown>;
|
||||
async receive(url: string, schema?: ZodType): Promise<unknown> {
|
||||
async receive<T extends ZodType | undefined>(url: string, schema?: T): Promise<T extends undefined ? unknown : output<T>> {
|
||||
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<T>;
|
||||
}
|
||||
|
||||
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<T>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user