From 3f2665c3cac1ba420ccb6a9ed392f4a6e1cc5573 Mon Sep 17 00:00:00 2001 From: xLuxy <67131061+xLuxy@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:32:30 +0100 Subject: [PATCH] typings: Fix RPC.register overload --- types/client/index.d.ts | 2 ++ types/client/package.json | 2 +- types/server/index.d.ts | 3 ++- types/server/package.json | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/client/index.d.ts b/types/client/index.d.ts index d405b79c1..1fd19c9b9 100644 --- a/types/client/index.d.ts +++ b/types/client/index.d.ts @@ -1423,7 +1423,9 @@ declare module "@altv/client" { export type GenericRpcEventHandler = (...args: T) => Promise | unknown; export function send(rpcName: E, ...args: Parameters): Promise>; + export function register(rpcName: E, handler: GenericRpcEventHandler>): RPCHandler; + export function register(rpcName: Exclude, handler: GenericRpcEventHandler): RPCHandler; } // DO NOT TOUCH THIS - This is only here so client / server can extend Utils namespace using merging diff --git a/types/client/package.json b/types/client/package.json index 556344a63..3db5e7e5c 100644 --- a/types/client/package.json +++ b/types/client/package.json @@ -1,6 +1,6 @@ { "name": "@altv/client", - "version": "0.0.6", + "version": "0.0.7", "description": "This package contains the type definitions for the alt:V JS module v2 client types", "types": "index.d.ts", "files": [ diff --git a/types/server/index.d.ts b/types/server/index.d.ts index 0145525f5..1e743c53f 100644 --- a/types/server/index.d.ts +++ b/types/server/index.d.ts @@ -917,7 +917,8 @@ declare module "@altv/server" { export namespace RPC { export type CustomPlayerRpcEventHandler = (player: U, ...args: T) => unknown | Promise; - export function register(rpcName: E, handler: CustomPlayerRpcEventHandler, T>): RPCHandler; + export function register(rpcName: E, handler: CustomPlayerRpcEventHandler, U>): RPCHandler; + export function register(rpcName: Exclude, handler: CustomPlayerRpcEventHandler): RPCHandler; } export abstract class ConnectionInfo { diff --git a/types/server/package.json b/types/server/package.json index 9d7d5d7ef..7fc815b0a 100644 --- a/types/server/package.json +++ b/types/server/package.json @@ -1,6 +1,6 @@ { "name": "@altv/server", - "version": "0.0.6", + "version": "0.0.7", "description": "This package contains the type definitions for the alt:V JS module v2 server types", "types": "index.d.ts", "files": [