npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@entityseven/fivem-rpc-shared-types

v0.1.0

Published

Shared (enhanced) types for @entityseven/fivem-rpc. Highly recommended to install together

Readme

FiveM RPC Shared Types

Docs & Info

Installation

  pnpm i @entityseven/fivem-rpc-shared-types -D
  yarn add @entityseven/fivem-rpc-shared-types --dev
  bun add @entityseven/fivem-rpc-shared-types -d

Usage

This package is an enhanced type support for @entityseven/fivem-rpc. It provides ability to strictly type your events for better dx.

Example

This example is neat way to follow up but you can change it as you wish. It will use bun workspaces, pnpm workspaces work in a similar manner. Referring the following folder structure:

apps/
    - server/
        - package.json
        - tsconfig.json
    - client/
        - package.json
        - tsconfig.json
    - webview/
        - package.json
        - tsconfig.json
    - shared/ (this must be available in server, client and webview)
        - package.json

    - package.json (root package)
    - pnpm-workspace.yaml (only if using pnpm)
  • Environment folder: folder with server, client or webview code in it
  1. Install this package as dev dependency in your root package or in each environment folder separately

    apps/
        - server/ <- (if not installed root)
        - client/ <- (if not installed root)
        - webview/ <- (if not installed root)
        - shared/
       
        - package.json <- here
  2. In shared/ create folder fivem-rpc (or similar), inside it create index.d.ts

    apps/
        - server/ 
        - client/ 
        - webview/ 
        - shared/
            - fivem-rpc/
                - index.d.ts <- here
       
        - package.json
  3. In index.d.ts add following:

    declare module '@entityseven/fivem-rpc-shared-types' {
        // Client commands names 
        export type RPCCommands_Client = ''
    
        // Server commands names
        export type RPCCommands_Server = ''
    
        // Client -> Client events
        export interface RPCEvents_Client {}
    
        // Client -> Server events
        export interface RPCEvents_ClientServer {}
    
        // Client -> Webview events
        export interface RPCEvents_ClientWebview {}
    
        // Server -> Server events
        export interface RPCEvents_Server {}
    
        // Server -> Client events
        export interface RPCEvents_ServerClient {}
    
        // Server -> Server events
        export interface RPCEvents_ServerWebview {}
    
        // Webview -> Webview events
        export interface RPCEvents_Webview {}
    
        // Webview -> Client events
        export interface RPCEvents_WebviewClient {}
    
        // Webview -> Server events
        export interface RPCEvents_WebviewServer {}
    }
  4. We just created a declaration which will overwrite types from the package. Now we need our packages to refer to these types when linting rpc functions. To do this in each environment folder of your project in tsconfig.json do these:

    {
        "compilerOptions": {
            "types": [
                "../shared/fivem-rpc/" // or your specific folder
            ]
        } 
    }
  5. We also need to populate interfaces we created in step 3.

  • RPCCommands_Client and RPCCommands_Server will include your commands names an union strings:
    export type RPCCommands_Client = 'afk' | 'vanish' | '...' // example names
    export type RPCCommands_Server = 'report' | 'ban' | '...' // example names
  • Other interfaces will include your events types. The example will show one but all of the work same way
    export interface RPCEvents_ClientServer {
        clientToServerEventName(data: string, moreData: boolean): number
        "client-to-server-event-name"(data: string, moreData: boolean): number // can also include characters you cannot use as variable or function names
    }
    • clientToServerEventName or client-to-server-event-name is an event name
    • data and moreData are the arguments you need to pass when calling an event and argument you will receive when listening (may also include extra, as player, check type hints)
    • number is a return type that will be forwarded back to caller
    Doing this will create type hints for you:
    // assuming this is in client
    const response /* number */ = await rpc.emitServer(
    'clientToServerEventName', /* suggested name */
    'data', /* will pass typecheck */
    'moreData', /* will NOT pass typecheck, since required type is `boolean` */
    )

Example (alternative)

If previous example does not work or you do not like you can also try it this way. Steps that are not mentioned are the same as previous

  1. In shared/ create folders declarations/fivem-rpc, inside it create index.d.ts

    apps/
        - server/ 
        - client/ 
        - webview/ 
        - shared/
            - declarations/
               - fivem-rpc/
                   - index.d.ts <- here
       
        - package.json
  2. We just created a declaration which will overwrite types from the package. Now we need our packages to refer to these types when linting rpc functions. To do this in each environment folder of your project in tsconfig.json do these:

    {
        "compilerOptions": {
            "typeRoots": [
                "../shared/declarations/", // or your specific folder
                "../../node_modules/@types", // you may also want to add this if some of your other libraries are not showing types now
            ]
        } 
    }

If a any point this stops working for you, do your research on how to redeclare library types and refer to it