Registry / serialization / un-typescript-to-lua

un-typescript-to-lua

JSON →
library0.0.1jsnpmunverified

A generic TypeScript to Lua transpiler that converts TypeScript code into readable and efficient Lua code. Current stable version is 0.0.1, released as an initial alpha. Development is active on GitHub with regular commits. Key differentiators: allows writing TypeScript for any Lua environment, supports declaring existing Lua APIs via declaration files, and integrates with standard TypeScript tooling.

npm install un-typescript-to-lua
INSTALL
IMPORT
SIG · UN-TYPESCRIPT-TO-L
U
un-typescript-to-lua
serializationjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transpile
import { transpile } from 'typescript-to-lua'
const transpile = require('typescript-to-lua').transpile
ESM only; package does not support CommonJS.
transpileString
import { transpileString } from 'typescript-to-lua'
import transpileString from 'typescript-to-lua'
Named export, not default.
TranspileOptions
import type { TranspileOptions } from 'typescript-to-lua'
import { TranspileOptions } from 'typescript-to-lua'
Use type-only import for types.
LuaTarget
import { LuaTarget } from 'typescript-to-lua'
import { LuaTarget } from 'tstl'
Export is from 'typescript-to-lua', not the CLI binary.
Compiler
import { Compiler } from 'typescript-to-lua'
const Compiler = require('tstl').Compiler
Class export; use named import.

Transpile a simple TypeScript function to Lua using the API.

import { transpileString } from 'typescript-to-lua'; const luaCode = transpileString(` function greet(name: string): string { return "Hello, " + name; } `, { luaTarget: '5.3', }); console.log(luaCode);
un-typescript-to-lua --version
Debug
Known issues
breakingv0.0.1 is an early alpha; API may change without notice.
fix
Pin exact version and watch changelog.
affects: 0.0.1
gotchaTypeScript features not fully supported; e.g., iterators, generators, async/await are not transpiled.
fix
Consult documentation for supported features.
affects: all
gotchaLua target version must be specified; default may not match your environment.
fix
Set luaTarget option explicitly to '5.1', '5.2', '5.3', or 'JIT'.
affects: all
gotchaString concatenation with + may produce unexpected results in Lua due to type coercion.
fix
Use template literals or explicit toString() calls.
affects: all
deprecatedThe `tstl` CLI command is deprecated in favor of programmatic API.
fix
Use the JavaScript API or migrate to new CLI if available.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'typescript'
Missing TypeScript peer dependency.
fix
npm install -D typescript@~4.5.2
TypeError: transpileString is not a function
Incorrect import (wrong way).
fix
Use import { transpileString } from 'typescript-to-lua'
Error: Lua target must be one of: 5.1, 5.2, 5.3, JIT
Invalid luaTarget option.
fix
Set luaTarget to a valid target version.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
typescriptrequiredpeer dependency required for TypeScript compilation
Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
2
Amazon
1
Resources
un-typescript-to-lua — npm install un-typescript-to-lua · libregistry