Developing with TypeScript
Choose this path after you understand the structure of regular and Reflex modules and want types, completion, a multi-file project, and error checking before the game starts. Lua is the simpler route for a first module.
How it works
Section titled “How it works”You write the client and server parts in TypeScript. The community compiler:
- checks API availability for the client and Reflex server;
- bundles imported files and transpiles them to Lua;
- creates the required
config.json,inputs.json, and entry points; - synchronizes a folder module for hot reload or builds a
.KillScriptpackage.
The game still runs a regular Lua module. The toolchain grants no additional permissions and bypasses no API restrictions: client code remains client-side, while server logic still requires Reflex.
TypeScript → validation and build → scripts/main.lua + scripts/server.lua → KILLSCRIPTSmall example
Section titled “Small example”A key binding can live next to the code that consumes it:
import { Keyboard, defineControls } from "@killscript/sdk/client";
const controls = defineControls("hello", { showMessage: Keyboard.F6,});
controls.showMessage.onPressed(() => { NotificationController.ShowHint("Hello from TypeScript", 2);});During the build, the declaration becomes part of the game’s input configuration and the callback becomes generated scripts/main.lua code. The result uses the same NotificationController as a module written directly in Lua.
Continue with the toolchain
Section titled “Continue with the toolchain”Installation, the CLI, project architecture, SDK wrappers, and limitations live in the separate KILLSCRIPT TypeScript SDK documentation.
The toolchain source is available in the killscript repository. Before updating dependencies, read the documentation for the selected version and test the result in the game.