{"id":25068,"library":"civvi-types","title":"Civ VI TypeScript Types","description":"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.","status":"active","version":"1.0.11","language":"javascript","source_language":"en","source_url":"https://github.com/Wild-W/civvi-types","tags":["javascript","typescript","lua","tstl","language extensions","civilization","modding","civ 6"],"install":[{"cmd":"npm install civvi-types","lang":"bash","label":"npm"},{"cmd":"yarn add civvi-types","lang":"bash","label":"yarn"},{"cmd":"pnpm add civvi-types","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Lua core type definitions (coroutine, global, math, etc.) needed by TSTL.","package":"lua-types","optional":false},{"reason":"Provides language extensions (LuaTable, etc.) used in Civ6 modding types.","package":"@typescript-to-lua/language-extensions","optional":false},{"reason":"Peer dependency for type checking; not needed at runtime.","package":"typescript","optional":true}],"imports":[{"note":"Types are globally available via tsconfig types; no explicit import needed.","wrong":"import { something } from 'civvi-types'","symbol":"Civ6 API types (global)","correct":"Add 'civvi-types' to 'types' array in tsconfig.json"},{"note":"LuaTable is from language-extensions package, not civvi-types.","wrong":"import { LuaTable } from 'civvi-types'","symbol":"LuaTable","correct":"Provided by @typescript-to-lua/language-extensions"},{"note":"All Civ6 API types are global; no import/require is necessary.","wrong":"const Player = require('civvi-types').Player","symbol":"Player","correct":"Use Player directly as global type (no import)"}],"quickstart":{"code":"// tsconfig.json\n{\n    \"compilerOptions\": {\n        \"target\": \"esnext\",\n        \"lib\": [\"ES2022.Array\", \"ES2022.Error\", \"ES2022.Object\", \"ES2022.String\", \"ES2015.Promise\", \"ES5\", \"ES2015.Iterable\"],\n        \"moduleResolution\": \"node\",\n        \"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\"],\n        \"strict\": true\n    },\n    \"tstl\": {\n        \"luaTarget\": \"5.1\",\n        \"luaLibImport\": \"inline\",\n        \"noImplicitGlobalVariables\": true,\n        \"noImplicitSelf\": true\n    }\n}\n\n// Example mod file: ModMain.ts\nconst pPlayer = Players[0]; // Player type inferred from civvi-types\nconst cap = pPlayer:GetCapitalCity(); // Uses Lua-style method call\nprint(cap:GetName()); // Type-safe print","lang":"typescript","description":"Shows tsconfig setup with required types and a simple mod snippet using global Player type."},"warnings":[{"fix":"Do not use import statements. Add 'civvi-types' to the 'types' array in tsconfig.json.","message":"Types are global; do not import from 'civvi-types' directly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ':' for method calls: object:method() not object.method().","message":"All Civ6 API functions use Lua-style colon syntax (method calls with ':' instead of '.'). Forgetting this causes runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to 1.0.11 and follow new tsconfig pattern.","message":"Old versions (pre-1.0.0) used different package name or import patterns.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Install typescript, typescript-to-lua, lua-types, and @typescript-to-lua/language-extensions.","message":"Requires TSTL (TypeScriptToLua) to transpile to Lua. Pacakge alone does not produce runnable mods.","severity":"gotcha","affected_versions":">=1.0.0"},{"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'.","message":"The 'types' array must include lua-types and language-extensions in the correct order for type resolution.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add \"civvi-types\" to compilerOptions.types in tsconfig.json.","cause":"Missing 'civvi-types' in tsconfig types array.","error":"Cannot find name 'Player'."},{"fix":"Replace '.' with ':' for method calls: object:method() instead of object.method().","cause":"Using dot notation instead of colon for Lua method calls.","error":"TypeError: object.method is not a function"},{"fix":"Remove import statement; civvi-types is a global type package, not a module.","cause":"Attempting to import civvi-types instead of adding to types array.","error":"Cannot find module 'civvi-types' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}