Skip to content

Package Type Extraction

Installed Luau packages don’t ship TypeScript types, so importing them would normally resolve to any. The rbx-tsx types command reads each package’s Luau source and emits a declare module block, giving your imports real types.

Terminal window
wally install # or: pesde install
rbx-tsx types # reads wally.toml / pesde.toml + the Packages/ folder
FlagDescriptionDefault
-o, --output <dir>Output directory for the generated .d.ts filestypes/packages

Add the output directory to your tsconfig.json include (e.g. "types/**/*") so TypeScript picks the declarations up. Re-run after installing or updating packages.

For each dependency it reads the package’s Luau source, extracts export type aliases and the module’s exported shape, and emits a declare module block:

  • Exported type aliases (with generics)
  • Function signatures
  • Table / record shapes
  • Unions, optionals
  • Common ecosystem aliases (ArrayT[], Map/Set → TS Map/Set, ObjectRecord<string, any>)

Constructs the extractor can’t resolve degrade gracefully to any rather than failing:

  • Metatable classes and typeof(setmetatable(...))
  • Cross-module type references
  • Luau type functions

Packages that ship bundled hand-written types (react, react-roblox, react-dom) are skipped.