Skip to content

API reference ​

Every built-in class, function and module, generated from the declaration files that ship with ThicketScript. The same files power hover, completion and go-to-definition in the IDE plugin and in thicket mcp.

Always available ​

In scope in every file. No import needed.

  • Global functions: Output, timers, parsers, type checks and the global constants.
  • console: Leveled logging to stdout and stderr.
  • String: The string type and its methods.
  • Number conversions: Conversion functions and constants for numbers: Int(x), Float(x), Int.MAX, Number.isInteger and friends. The types themselves are lowercase: int, uint, float, and int8 to float32 for packed storage.
  • Number methods: Methods you can call on a number value, such as n.toFixed(2). The class names on this page are internal; you never write them in code.
  • Math: Math functions and constants.
  • Random: Seedable random number generators.
  • Array, Map and Set: The collection types: Array, FixedArray, Map, Set and the weak references.
  • Buffers and typed arrays: ByteArray, Buffer, the typed arrays and their encodings.
  • Promise: Async results for async / await.
  • Errors: The built-in error classes.
  • JSON: Parse and stringify JSON.
  • Object: Object helpers and Proxy.
  • RegExp: Regular expressions.
  • URL: Parse and build URLs and query strings.
  • App and System: The app lifecycle (App), process and platform info (System), and autotest hooks.
  • Input constants: Key, GamepadButton, GamepadAxis and MouseCursor.
  • InputMap: Named actions bound to keys, buttons and axes.
  • Color: The Color value type: construct, convert and adjust colors.
  • Geometry: The Vec2, Point, Vec3, Size and Rect value types.
  • Date and Duration: Dates, times, time zones and durations.
  • Ease: Easing curves for animation and tweens.
  • Ticker: Timers and sequences that advance with the app tick.
  • BitmapRect: The rectangle Bitmap.contentBounds returns.

Modules ​

Import what you use, for example import { Files } from "fs";. Some modules also need a permission in thicket.json; each page says so where it applies.

  • audio: Sound playback, mixing, music, procedural sound effects and 3D spatial sound.
  • bitmap: Bitmaps: load, draw, composite and save images.
  • compress: zlib and gzip deflate and inflate, with streaming helpers.
  • crypto: Hashing, HMAC, AES, PBKDF2, random bytes and UUIDs.
  • database: Database connections: SQLite, MySQL, PostgreSQL, Redis and MongoDB.
  • env: Environment variables.
  • events: String-keyed event channels with EventEmitter.
  • fs: Files and directories.
  • http: Asynchronous HTTP client and an HTTP server.
  • net: TCP sockets.
  • reactivity: Signals, refs, computed values and reactive collections.
  • shell: Run child processes.
  • terminal: Terminal input, output, cursor control and ANSI styling.
  • udp: UDP datagram sockets.
  • ws: WebSocket client and server.