# 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.

## Types (TBD)

The SDK has the following developer-facing types:

### NeuroClient

The [`NeuroClient` class](/neuro-sdk-docs/js/api/client) has a TypeScript declaration of the following:

#### Properties

- `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.

#### Methods

- `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`](#action-packets)`[]`

### Action packets

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

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

Which is then used in this packet:

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