Skip to content

tsconfig.json

tslua reads standard tsconfig.json files. tslua-specific options go under the "tstl" key.

{
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext"],
"strict": true
},
"tstl": {
"luaTarget": "JIT"
}
}

All options go under "tstl" in tsconfig.json.

OptionTypeDefaultDescription
luaTargetstring"JIT"Lua version: JIT, 5.0-5.5, universal
emitModestring"tstl""tstl" (match TSTL output) or "optimized" (cleaner Lua)
luaLibImportstring"require"How polyfills are included: require, inline, none
noImplicitSelfboolfalseDefault all functions to no-self calling convention
noImplicitGlobalVariablesboolfalseRoot-level declarations are local in non-module files
exportAsGlobalbool | stringfalseStrip module wrapper, emit exports as globals. true applies to all files; a string is a regex matching file paths.
sourceMapTracebackboolfalseApply source maps to Lua stack traces
luaBundlestringBundle all output into a single Lua file (requires luaBundleEntry)
luaBundleEntrystringEntry point for bundle mode (requires luaBundle)
classStylestringClass emit preset: "tstl", "luabind", "middleclass", "inline". See Class Styles

Standard compilerOptions work normally.

OptionRecommendationNotes
target"ESNext"Controls type checking, not Lua output. ESNext gives access to all features.
lib["ESNext"]Required - provides types for Promise, Map, Set, etc.
moduleResolution"bundler"
stricttrue
jsx"react" or "react-jsx"For JSX support
experimentalDecoratorstrueFor legacy decorator syntax
OptionNotes
outFileUse luaBundle instead
importHelpers / noEmitHelpersUse luaLibImport instead
composite / incrementalNot supported
emitDecoratorMetadataNot supported