split cef types

This commit is contained in:
Oleksandr Honcharov 2024-06-13 05:00:24 +03:00
parent 7a506a02e2
commit 95352908f8
4 changed files with 83 additions and 87 deletions

32
cef/src/types/cef.ts Normal file
View File

@ -0,0 +1,32 @@
import { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
export { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
/**
* Union of all available cef event names
* These only include custom events
*/
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
/**
* Array of arguments of an event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefArguments<K extends RageFW_CefEvent> = Parameters<
RageFW_ICustomCefEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
RageFW_ICustomCefEvent[K]
>
/**
* Callback (function) of event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
args: RageFW_CefArguments<K>,
) => RageFW_CefReturn<K>

24
cef/src/types/client.ts Normal file
View File

@ -0,0 +1,24 @@
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
export type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
/**
* Union of all available client event names
* These only include custom events
*/
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
/**
* Array of arguments of event you pass as a generic
* These only include custom client events
*/
export type RageFW_ClientArguments<K extends RageFW_ClientEvent> = Parameters<
RageFW_ICustomClientEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom client events
*/
export type RageFW_ClientReturn<K extends RageFW_ClientEvent> = ReturnType<
RageFW_ICustomClientEvent[K]
>

View File

@ -1,87 +1,3 @@
/// <reference types="@ragempcommunity/types-cef" /> export * from './cef'
export * from './client'
import type { export * from './server'
RageFW_ICustomCefEvent,
RageFW_ICustomClientEvent,
RageFW_ICustomServerEvent,
} from 'rage-fw-shared-types'
export type {
RageFW_ICustomCefEvent,
RageFW_ICustomServerEvent,
RageFW_ICustomClientEvent,
} from 'rage-fw-shared-types'
/**
* Union of all available cef event names
* These only include custom events
*/
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
/**
* Union of all available server event names
* These only include custom events
*/
export type RageFW_ServerEvent = keyof RageFW_ICustomServerEvent
/**
* Union of all available client event names
* These only include custom events
*/
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
/**
* Array of arguments of an event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefArguments<K extends RageFW_CefEvent> = Parameters<
RageFW_ICustomCefEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
RageFW_ICustomCefEvent[K]
>
/**
* Callback (function) of event you pass as a generic
* These only include custom cef events
*/
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
args: RageFW_CefArguments<K>,
) => RageFW_CefReturn<K>
/**
* Array of arguments of event you pass as a generic
* These only include custom server events
*/
export type RageFW_ServerArguments<K extends RageFW_ServerEvent> = Parameters<
RageFW_ICustomServerEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom server events
*/
export type RageFW_ServerReturn<K extends RageFW_ServerEvent> = ReturnType<
RageFW_ICustomServerEvent[K]
>
/**
* Array of arguments of event you pass as a generic
* These only include custom client events
*/
export type RageFW_ClientArguments<K extends RageFW_ClientEvent> = Parameters<
RageFW_ICustomClientEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom client events
*/
export type RageFW_ClientReturn<K extends RageFW_ClientEvent> = ReturnType<
RageFW_ICustomClientEvent[K]
>

24
cef/src/types/server.ts Normal file
View File

@ -0,0 +1,24 @@
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
export type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
/**
* Union of all available server event names
* These only include custom events
*/
export type RageFW_ServerEvent = keyof RageFW_ICustomServerEvent
/**
* Array of arguments of event you pass as a generic
* These only include custom server events
*/
export type RageFW_ServerArguments<K extends RageFW_ServerEvent> = Parameters<
RageFW_ICustomServerEvent[K]
>
/**
* Return type of event you pass as a generic
* These only include custom server events
*/
export type RageFW_ServerReturn<K extends RageFW_ServerEvent> = ReturnType<
RageFW_ICustomServerEvent[K]
>