@bgforge/iets (Infinity Engine TypeScript) is the type library consumed by TBAF and TD - two TypeScript-like transpilers that ship with BGforge MLS. It is not a runtime: it provides typed declarations for every engine trigger, action, object specifier, and IDS constant so your editor can offer completion, hover, and type-checking when writing scripts and dialogs.
.tbaf -> TBAF transpiler -> .baf -> WeiDU -> installed mod (AI scripts)
.td -> TD transpiler -> .d -> WeiDU -> installed mod (dialogs)
In both pipelines IETS supplies the type information that makes the TypeScript-side code type-check. The transpilers do not emit any IETS code into the WeiDU output; the types exist purely for the editor and the TypeScript compiler.
The fastest path is to clone the official template:
git clone https://github.com/BGforgeNet/tbaf-example.git
cd tbaf-example
pnpm install
Then open it in VS Code with BGforge MLS installed. Open script.tbaf and press Ctrl+R (or run BGforge MLS: compile) to transpile to script.baf.
To add IETS to an existing mod project:
pnpm add @bgforge/iets
See the tbaf-example readme for the full set of recommended files (.gitignore, .gitattributes, ESLint config, VS Code excludes).
| Import path | Contents |
|---|---|
@bgforge/iets |
Core types and constants: IE<T, B>, Action, ObjectPtr, Point, ResRef, Scope, GLOBAL, LOCALS, MYAREA, obj(). |
@bgforge/iets/bg2 |
BG2 engine surface: actions, triggers, object identifiers, and every IDS constant. |
A representative .tbaf import block, from the official example:
import { LOCALS } from "@bgforge/iets";
import {
FaceObject, Global, LastSeenBy, LevelGT, LevelLT,
Myself, NearestEnemyOf, Player1,
ReallyForceSpell, ReallyForceSpellRES, See, SetGlobal,
SmallWait, StartDialog,
WIZARD_ARMOR, WIZARD_SHIELD,
} from "@bgforge/iets/bg2";
Triggers (See, Global, LevelLT), actions (SetGlobal, ReallyForceSpell, StartDialog), object identifiers (Player1, Myself, LastSeenBy), object helpers (NearestEnemyOf), and IDS constants (WIZARD_ARMOR, WIZARD_SHIELD) all live under the same bg2 barrel.
IE<T, B> nominal-type pattern and why resrefs are deliberately unbranded.