Skip to content
Snippets Groups Projects
Unverified Commit b1b266e8 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:bug: (typescript) patching sendCatch type (#2343)

* :bug: (typescript) patching sendCatch type

* Release notes
parent 58626c00
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,14 @@ import type { ServerEvents } from '../../../types/server-events';
export function init(socketName: string): Promise<unknown>;
export type Init = typeof init;
export function send<K extends keyof Handlers>(
name: K,
args?: Parameters<Handlers[K]>[0],
options?: { catchErrors: true },
): ReturnType<
| { data: Handlers[K] }
| { error: { type: 'APIError' | 'InternalError'; message: string } }
>;
export function send<K extends keyof Handlers>(
name: K,
args?: Parameters<Handlers[K]>[0],
......@@ -14,7 +22,10 @@ export type Send = typeof send;
export function sendCatch<K extends keyof Handlers>(
name: K,
args?: Parameters<Handlers[K]>[0],
): ReturnType<Handlers[K]>;
): ReturnType<
| { data: Handlers[K] }
| { error: { type: 'APIError' | 'InternalError'; message: string } }
>;
export type SendCatch = typeof sendCatch;
export function listen<K extends keyof ServerEvents>(
......
......@@ -78,7 +78,6 @@ export const init: T.Init = async function () {
return new Promise(connectSocket);
};
// @ts-expect-error Figure out why typechecker is suddenly breaking here
export const send: T.Send = function (
name,
args,
......
---
category: Maintenance
authors: [MatissJanis]
---
Patching an incorrect TypeScript type definition used for `sendCatch` method return value.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment