refactor client types

This commit is contained in:
Oleksandr Honcharov 2024-06-10 18:02:57 +03:00
parent 77d667ce67
commit 47ce0a6b16

View File

@ -5,22 +5,20 @@ import type {
RageFW_ICustomServerEvent,
} from 'rage-fw-shared-types'
export type RageFW_ClientEvent =
| keyof RageFW_ICustomClientEvent
| keyof IClientEvents
export type RageFW_ClientEvent = keyof RageFW_ICustomServerEvent
export type RageFW_ClientEventArguments<K extends RageFW_ClientEvent> =
K extends keyof RageFW_ICustomClientEvent
? Parameters<RageFW_ICustomClientEvent[K]>
: (K extends keyof IClientEvents ? IClientEvents[K] : never)[]
K extends keyof RageFW_ICustomServerEvent
? Parameters<RageFW_ICustomServerEvent[K]>
: never
export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
K extends keyof RageFW_ICustomClientEvent
? ReturnType<RageFW_ICustomClientEvent[K]>
: never
export type RageFW_ClientServerEvent = keyof RageFW_ICustomServerEvent
export type RageFW_ClientServerEvent = keyof RageFW_ICustomClientEvent
export type RageFW_ClientServerCallback<K extends RageFW_ClientServerEvent> = (
args: Parameters<RageFW_ICustomServerEvent[K]>,
) => ReturnType<RageFW_ICustomServerEvent[K]>
args: Parameters<RageFW_ICustomClientEvent[K]>,
) => ReturnType<RageFW_ICustomClientEvent[K]>