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
types-lua
as a dependency and load it by adding/// <reference types="types-lua/VERSION" />
- Get Lua Types from npm
yarn add -D types-lua
# or
npm install -D types-lua
- Modify your
tsconfig.json
{
"compilerOptions": {
"types": ["types-lua/VERSION"]
}
}
Currently supported values of VERSION
are:
5.1
5.2
5.3
5.4
jit
Some Lua environments are sandboxed and don't have some globals declared, like io
, os
and
debug
. To avoid registering these globals you should look at the version-specific file at the root
of this package and loaded each of it's dependencies separately. For example
{
"compilerOptions": {
"types": [
"types-lua/core/coroutine",
"types-lua/core/debug",
"types-lua/core/global",
"types-lua/core/math",
"types-lua/core/metatable",
"types-lua/core/modules",
"types-lua/core/string",
"types-lua/core/table",
"types-lua/special/5.1-only",
"types-lua/special/jit-only"
]
}
}