Write and compile TypeScript code to Lua.
A documentation in your IDE. Types safety. Linting.
Features
-
🔥 TypeScriptToLua
Provides compilation. -
📓 MTASA Lua Types
Provides types declarations and the documentation for MTASA Functions and classes. -
✅ MTASA Lua Utils
Provides code preparation and MTASA specific linting. -
✒️ Prettier
Code formatter -
⌛ In the future: ESLint for linting TypeScript Code
This boilerplate requires NodeJS to be installed. If you already have NodeJS installed, skip this step.
Installation for Windows.
Installation for Linux:
Debian or Ubuntu
apt install nodejs
Arch or Manjaro
pacman -S nodejs
How to check NodeJS installation
Open console (What?) and execute the command
npm version
The boilerplate should be downloaded into the resources folder.
You can use git
:
git clone https://github.com/mtasa-typescript/resource-boilerplate.git
git remote remove origin
Or you can download the boilerplate as a .zip
archive:
Go to the project folder and execute command in the console:
npm install --save-dev
Command:
npm run build
Always running the command to build the resource is annoying. Below there are possible solutions to simplify it.
Ctrl+Mouse Hover
is the shortcut to show documentation window.
Ctrl+Shift+Space
is the shortcut to show function's parameters.
Use Ctrl+Shift+B
and select npm: build
task to compilte the resource.
Plugin Trigger Task On Save should be installed.
Configuration provided in .vscode/settings.json and will be enabled by default.
Ctrl+Q
is the shortcut to show documentation window.
Ctrl+P
is the shortcut to highlight function's parameters.
NOTE: In the current version configuration should have been loaded by default.
In the top right corner press Edit Configurations
.
Press Add New Configuration
(Plus icon), select npm
and select build in Scripts
field.
Now you can press Shift+F10
to compile your resource.
NOTE: In the current version file watcher should have been loaded by default.
Compile can be executed after file saving.
Open Settings
-> Tools
-> File watchers
.
Add new file watcher for TypeScript files in project scope.
Put npm into the Script
field and run build into the Srguments
field.
Thus, saving after editing TypeScript files triggers compilation.