{"id":26568,"library":"un-typescript-to-lua","title":"TypeScriptToLua","description":"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.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/TypeScriptToLua/TypeScriptToLua","tags":["javascript","typescript","lua","tstl","transpiler"],"install":[{"cmd":"npm install un-typescript-to-lua","lang":"bash","label":"npm"},{"cmd":"yarn add un-typescript-to-lua","lang":"bash","label":"yarn"},{"cmd":"pnpm add un-typescript-to-lua","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for TypeScript compilation","package":"typescript","optional":false}],"imports":[{"note":"ESM only; package does not support CommonJS.","wrong":"const transpile = require('typescript-to-lua').transpile","symbol":"transpile","correct":"import { transpile } from 'typescript-to-lua'"},{"note":"Named export, not default.","wrong":"import transpileString from 'typescript-to-lua'","symbol":"transpileString","correct":"import { transpileString } from 'typescript-to-lua'"},{"note":"Use type-only import for types.","wrong":"import { TranspileOptions } from 'typescript-to-lua'","symbol":"TranspileOptions","correct":"import type { TranspileOptions } from 'typescript-to-lua'"},{"note":"Export is from 'typescript-to-lua', not the CLI binary.","wrong":"import { LuaTarget } from 'tstl'","symbol":"LuaTarget","correct":"import { LuaTarget } from 'typescript-to-lua'"},{"note":"Class export; use named import.","wrong":"const Compiler = require('tstl').Compiler","symbol":"Compiler","correct":"import { Compiler } from 'typescript-to-lua'"}],"quickstart":{"code":"import { transpileString } from 'typescript-to-lua';\n\nconst luaCode = transpileString(`\n  function greet(name: string): string {\n    return \"Hello, \" + name;\n  }\n`, {\n  luaTarget: '5.3',\n});\n\nconsole.log(luaCode);","lang":"typescript","description":"Transpile a simple TypeScript function to Lua using the API."},"warnings":[{"fix":"Pin exact version and watch changelog.","message":"v0.0.1 is an early alpha; API may change without notice.","severity":"breaking","affected_versions":"0.0.1"},{"fix":"Consult documentation for supported features.","message":"TypeScript features not fully supported; e.g., iterators, generators, async/await are not transpiled.","severity":"gotcha","affected_versions":"all"},{"fix":"Set luaTarget option explicitly to '5.1', '5.2', '5.3', or 'JIT'.","message":"Lua target version must be specified; default may not match your environment.","severity":"gotcha","affected_versions":"all"},{"fix":"Use template literals or explicit toString() calls.","message":"String concatenation with + may produce unexpected results in Lua due to type coercion.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the JavaScript API or migrate to new CLI if available.","message":"The `tstl` CLI command is deprecated in favor of programmatic API.","severity":"deprecated","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install -D typescript@~4.5.2","cause":"Missing TypeScript peer dependency.","error":"Error: Cannot find module 'typescript'"},{"fix":"Use import { transpileString } from 'typescript-to-lua'","cause":"Incorrect import (wrong way).","error":"TypeError: transpileString is not a function"},{"fix":"Set luaTarget to a valid target version.","cause":"Invalid luaTarget option.","error":"Error: Lua target must be one of: 5.1, 5.2, 5.3, JIT"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}