diff --git a/types/client/index.d.ts b/types/client/index.d.ts index 1fd19c9b9..79e90ef7f 100644 --- a/types/client/index.d.ts +++ b/types/client/index.d.ts @@ -1420,12 +1420,13 @@ declare module "@altv/client" { } export namespace RPC { - export type GenericRpcEventHandler = (...args: T) => Promise | unknown; + export type GenericRpcEventHandler = (...args: T) => Promise | U; export function send(rpcName: E, ...args: Parameters): Promise>; + export function send(rpcName: Exclude, ...args: unknown[]): Promise; - export function register(rpcName: E, handler: GenericRpcEventHandler>): RPCHandler; - export function register(rpcName: Exclude, handler: GenericRpcEventHandler): RPCHandler; + export function register(rpcName: E, handler: GenericRpcEventHandler, ReturnType>): 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 3db5e7e5c..612044594 100644 --- a/types/client/package.json +++ b/types/client/package.json @@ -1,6 +1,6 @@ { "name": "@altv/client", - "version": "0.0.7", + "version": "0.0.8", "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 1e743c53f..ac8c7de91 100644 --- a/types/server/index.d.ts +++ b/types/server/index.d.ts @@ -536,6 +536,7 @@ declare module "@altv/server" { playScenario(name: string): void; sendRPC(rpcName: E, ...args: Parameters): Promise>; + sendRPC(rpcName: Exclude, ...args: unknown[]): Promise; readonly meta: PlayerMeta; readonly localMeta: PlayerLocalMeta; @@ -915,10 +916,13 @@ declare module "@altv/server" { } export namespace RPC { - export type CustomPlayerRpcEventHandler = (player: U, ...args: T) => unknown | Promise; + export type CustomPlayerRpcEventHandler = (player: U, ...args: T) => Promise | V; - export function register(rpcName: E, handler: CustomPlayerRpcEventHandler, U>): RPCHandler; - export function register(rpcName: Exclude, handler: CustomPlayerRpcEventHandler): RPCHandler; + export function register( + rpcName: E, + handler: CustomPlayerRpcEventHandler, U, ReturnType> + ): 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 7fc815b0a..213bd0e21 100644 --- a/types/server/package.json +++ b/types/server/package.json @@ -1,6 +1,6 @@ { "name": "@altv/server", - "version": "0.0.7", + "version": "0.0.8", "description": "This package contains the type definitions for the alt:V JS module v2 server types", "types": "index.d.ts", "files": [