Registry / type-stubs / civvi-types

civvi-types

JSON →
library1.0.11jsnpmunverified

TypeScript declaration files for modding Civilization VI using the TypeScriptToLua transpiler. Version 1.0.11 provides type definitions for the Civ6 modding API, enabling type-safe Lua development with TypeScript. Released irregularly via npm. Key differentiator: bridges TypeScript to Lua for Civ6 modding, leveraging TSTL ecosystem. No stable release cadence; latest version as of early 2025 is 1.0.11.

npm install civvi-types
INSTALL
IMPORT
SIG · CIVVI-TYPES
C
civvi-types
type-stubsjavascriptv1.0.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Civ6 API types (global)
Add 'civvi-types' to 'types' array in tsconfig.json
import { something } from 'civvi-types'
Types are globally available via tsconfig types; no explicit import needed.
LuaTable
Provided by @typescript-to-lua/language-extensions
import { LuaTable } from 'civvi-types'
LuaTable is from language-extensions package, not civvi-types.
Player
Use Player directly as global type (no import)
const Player = require('civvi-types').Player
All Civ6 API types are global; no import/require is necessary.

Shows tsconfig setup with required types and a simple mod snippet using global Player type.

// tsconfig.json { "compilerOptions": { "target": "esnext", "lib": ["ES2022.Array", "ES2022.Error", "ES2022.Object", "ES2022.String", "ES2015.Promise", "ES5", "ES2015.Iterable"], "moduleResolution": "node", "types": ["lua-types/core/coroutine", "lua-types/core/global", "lua-types/core/math", "lua-types/core/metatable", "lua-types/core/string", "lua-types/core/table", "@typescript-to-lua/language-extensions", "civvi-types"], "strict": true }, "tstl": { "luaTarget": "5.1", "luaLibImport": "inline", "noImplicitGlobalVariables": true, "noImplicitSelf": true } } // Example mod file: ModMain.ts const pPlayer = Players[0]; // Player type inferred from civvi-types const cap = pPlayer:GetCapitalCity(); // Uses Lua-style method call print(cap:GetName()); // Type-safe print
Debug
Known issues
gotchaTypes are global; do not import from 'civvi-types' directly.
fix
Do not use import statements. Add 'civvi-types' to the 'types' array in tsconfig.json.
affects: >=1.0.0
gotchaAll Civ6 API functions use Lua-style colon syntax (method calls with ':' instead of '.'). Forgetting this causes runtime errors.
fix
Use ':' for method calls: object:method() not object.method().
affects: >=1.0.0
deprecatedOld versions (pre-1.0.0) used different package name or import patterns.
fix
Upgrade to 1.0.11 and follow new tsconfig pattern.
affects: <1.0.0
gotchaRequires TSTL (TypeScriptToLua) to transpile to Lua. Pacakge alone does not produce runnable mods.
fix
Install typescript, typescript-to-lua, lua-types, and @typescript-to-lua/language-extensions.
affects: >=1.0.0
gotchaThe 'types' array must include lua-types and language-extensions in the correct order for type resolution.
fix
Add exactly: 'lua-types/core/coroutine', 'lua-types/core/global', 'lua-types/core/math', 'lua-types/core/metatable', 'lua-types/core/string', 'lua-types/core/table', '@typescript-to-lua/language-extensions', 'civvi-types'.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find name 'Player'.
Missing 'civvi-types' in tsconfig types array.
fix
Add "civvi-types" to compilerOptions.types in tsconfig.json.
TypeError: object.method is not a function
Using dot notation instead of colon for Lua method calls.
fix
Replace '.' with ':' for method calls: object:method() instead of object.method().
Cannot find module 'civvi-types' or its corresponding type declarations.
Attempting to import civvi-types instead of adding to types array.
fix
Remove import statement; civvi-types is a global type package, not a module.
Upgrade
Version history
1.0.11latest on npm
Audit
Dependencies
lua-typesrequiredRequired for Lua core type definitions (coroutine, global, math, etc.) needed by TSTL.
@typescript-to-lua/language-extensionsrequiredProvides language extensions (LuaTable, etc.) used in Civ6 modding types.
typescriptoptionalPeer dependency for type checking; not needed at runtime.
Agent activity
51 hits · last 30 days
node
44
OpenAI (training)
1
Resources
civvi-types — npm install civvi-types · libregistry