2 releases
Uses new Rust 2024
| 0.1.3 | Oct 5, 2025 |
|---|---|
| 0.1.0 | Sep 20, 2025 |
#130 in Text editors
152 downloads per month
240KB
6.5K
SLoC
Typua
typua is a lua typechecker for Lua5.1, 5.2, 5.3, 5.4, LuaJIT.
Compatibled type-annotation syntax lua-language-server.
Features
- 🚀 Blazing Fast Typecheck
- 💾 Low memory usage
- 🖥️ Language Server Support
- 🌕️ Lua5.1, 5.2, 5.3, 5.4 and LuaJIT Supported
Status
- Type declaration
- builtin-type(nil, number, string, boolean, function, table)
- compound-type(union, array, tuple, dictionary, key-value table)
- class
- enum
- alias
- cast
- type coercion(as)
- generic function
- generic class and method
- Type check
- assign-type-mismatch
- return-type-mismatch
- param-type-mismatch
- field-type-mismatch
- table-shape-mismatch
- Suppert Lua Version
- Lua51
- Lua52
- Lua53
- Lua54
- LuaJIT
- performance
- Reducing check time
- Full Analysis of changed file
- Incremental Analysis of only the changed parts
- Reducing check time
- LSP Support
- Diagnostics
- Inlay hints
- Hover
- References
- Goto Type Defenition
Install
cargo
cargo install typua
Editor Integration
nvim
builtin lspconfig
vim.lsp.enable("typua")
vim.lsp.config("typua", {
cmd = { "typua", "lsp" },
filetypes = { "lua" },
root_markers = { ".git", ".typua.toml" },
settings = {
typua = {
workspace = {
library = {
vim.env.VIMRUNTIME,
}
}
},
},
})
Using with lua-ls
typua can be used in combination with lua-ls
{
cmd = { "lua-language-server" },
filetypes = { "lua" },
-- omitted...
settings = {
Lua = {
hint = { -- use with typua
enable = false,
},
diagnostics = { -- use with typua
enable = true,
disable = {
"assign-type-mismatch",
"param-type-mismatch",
"return-type-mismatch",
"undefined-field",
}
}
},
},
}
Configure
typua detects .typua.toml in workingspace root.
on the other hand, use --config/-c option like typua --config your_typua.toml.
[workspace]
ignore_dir = ["target"]
use_gitignore = true
Dependencies
~15–22MB
~383K SLoC