TypeScriptToLua supports plugins - an interface that allows to customize transpilation behavior.
To add a plugin you have to add it under
tstl.luaPlugins option in the configuration file.
Internally, to process Abstract Syntax Tree of a TypeScript program, TypeScriptToLua implements the visitor pattern. Visitor is a function, called with a processed node and transformation context, and returning a Lua AST node. Plugins can inject their own visitors using
visitors property, overriding standard transformation behavior.
Printer is a function that overrides standard implementation of Lua AST printer. It receives some information about the file and transformed Lua AST. See Printer page for more information.