Lua types (autocomplete for tm)
tm_lib ships escrowed, and the Lua language server (LuaLS, the VS Code "Lua" extension by sumneko) cannot read escrowed files. So the library also ships types/: declaration-only files (---@meta, annotations and empty function stubs) that are excluded from escrow in fxmanifest.lua. Point your workspace at that folder and tm.* gets autocomplete, hover docs and type checking in your own resources.
Set up a resource
Put a .luarc.json in the root of your resource (resources made from the Twilight Moon boilerplate already have one):
{
"runtime.version": "Lua 5.4",
"workspace.library": ["../tm_lib/types"],
"workspace.checkThirdParty": false
}The path is relative to the .luarc.json. ../tm_lib/types is right when your resource sits next to tm_lib. If it sits in a category folder such as [tm], use the path that reaches tm_lib/types from there, or an absolute path. types/luarc.example.json is the same file to copy.
Also install the CfxLua extension (overextended.cfxlua-vscode) for the FiveM natives, vector3 and promise, which the types refer to. The ox_lib globals (lib, cache) are not part of these types: add ox_lib's own type definitions to workspace.library as well if you want them.
What is in types/
generated/has one file per import (tm.log,tm.db, ...) and one for the interface functions such astm.notify. Each file adds its import to thetmglobal.manual/has thetmglobal itself and the bridge contracts (tm.fw,tm.inventory,tm.target), whose shape depends on the active adapter.
Types do not know which side a script runs on. tm.db is server only and tm.ui is client only, but both show up everywhere, so check the utility docs for which side an import is for.
Licensing
The generated files are produced from tm_lib's own annotations. They contain no ox_lib code, and the stubs hold no implementation.