Fix compile errors surfaced by actually building against Factorio 2.0.77

typed-factorio 2.0.0+ stopped declaring types as ambient globals - they
now live in virtual modules ("factorio:runtime", "factorio:common",
"factorio:settings") and must be explicitly imported. Adds those imports
throughout events-mod. Also:

- Bumps typescript-to-lua 1.11.1 -> 1.25.2 and typescript 4.9 -> 5.4.2,
  since tstl pins an exact peer TypeScript version and typed-factorio
  3.x needs a newer one than 4.9 supports (a real compiler bug in
  TS 4.9 against the generated defines.segmented_unit_ai_state enum).
- Bumps the pinned isolated Node (14.19.1 -> 24.21.0), since
  typescript-to-lua 1.25.2 requires Node >=16.10.0.
- Renames bare uint/int -> uint32/int32 (import aliases), since the
  unsized aliases no longer exist.
- Drops OnEntityDestroyedEvent from an unused documentation-only union
  type - that event no longer exists in the 2.0 API.
- LuaEntityPrototype.max_health is now get_max_health() (quality-aware).
- Fixes a branded-type mismatch between our generated schema's
  ForceIndex and typed-factorio's own ForceIndex.

Verified by actually running tstl end-to-end (clean compile, Lua
emitted) after installing a real JDK and Node toolchain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-10-12 15:27:50 +02:00
parent 072d1a2845
commit e296a9aa90
26 changed files with 285 additions and 79 deletions

View file

@ -7,14 +7,14 @@
"dev": "tstl --watch"
},
"engines": {
"node": "~14.19.1"
"node": ">=16.10.0"
},
"devDependencies": {},
"dependencies": {
"lua-types": "2.13.1",
"typescript-to-lua": "1.11.1",
"typescript-to-lua": "1.25.2",
"typed-factorio": "3.36.0",
"typescript": "4.9"
"typescript": "5.4.2"
},
"license": "GPL-3.0-only",
"peerDependencies": {},