TypeScript definitions for Lua standard library
NOTE: In most of cases your environment-specific types would already include this package. In that case you don't need to do anything. If you're a developer of such types you should add
lua-typesas a dependency and load it by adding/// <reference types="lua-types/VERSION" />
- Get Lua Types from npm
yarn add -D lua-types
# or
npm install -D lua-types- Modify your
tsconfig.json
{
"compilerOptions": {
"types": ["lua-types/VERSION"]
}
}Currently supported values of VERSION are:
5.15.25.35.4jit
Some Lua environments are sandboxed and don't have some globals declared, like io, os and
debug. To avoid registering these globals, you can import core files separately. For example:
{
"compilerOptions": {
"types": [
"lua-types/core/coroutine",
"lua-types/core/global",
"lua-types/core/math",
"lua-types/core/metatable",
"lua-types/core/modules",
"lua-types/core/string",
"lua-types/core/table",
"lua-types/special/jit"
]
}
}