Skip to content
This site is under heavy WIP, so contributions on GitHub are much appreciated! You've most likely been pointed to this site to point towards a concept, or something. Either way, take at least some of the info on this page with a grain of salt, and also don't expect much info since it's very incomplete on content.

TypeScript support

The JavaScript SDK also has built-in support for TypeScript. TypeScript is a typed superset of JavaScript that brings stricter typing to JavaScript (a normally loosely typed language).

When using exported functions from the JavaScript/TypeScript SDK, compatible editors will warn about:

  • Unexpected, missing or invalid props being passed to functions as inputs.
  • Input/output types being different than specified.
  • And more…

These warns will also be shown in your terminal when running tsc there.

The SDK has the following developer-facing types:

The NeuroClient class has a TypeScript declaration of the following:

  • ws?: string - The WebSocket connection.
  • game: string - The game name.
  • url: string - The WebSocket server URL (should start with ws://)
  • actionHandlers: ((actionData: { id: string; name: string; params: any; }) => void)[] - An array of action handlers.
  • constructor - NeuroClient constructor. Params: url: string, game: string, onConnected: () => void
  • sendContext: void - Context send function. Params: messageText: string, silent?: boolean
  • registerActions: void - Registers an action for Neuro to use. Params: actions: ActionDetails[]

When using actions/register the action details follow the below interface:

interface ActionDetails {
name: string;
description: string;
schema?: any;
}

Which is then used in this packet:

interface ActionsRegister {
command: "actions/register";
game: string;
data: {
actions: ActionDetails[];
};
}