Registry / type-stubs / folib
library0.4.1jsnpmunverified

FOlib provides TypeScript bindings for Fallout 2 engine scripting (sfall/TSSL). Current version 0.4.1, under active development with headers added on demand. Key differentiator: enables type-safe scripting for Fallout 2 mods using TSSL transpiler. Unlike raw JavaScript, provides declarations, definitions, and helper functions for sfall hooks, game APIs, and common patterns. Integrates with ESLint and TypeScript ESLint for linting.

npm install folib
INSTALL
IMPORT
SIG · FOLIB
F
folib
type-stubsjavascriptv0.4.1
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.

fo
✓ import { fo } from 'folib'
✗ import fo from 'folib'
fo is a named export, not default.
Game
✓ import { Game } from 'folib'
✗ const Game = require('folib').Game
ESM-only; no CommonJS support.
types
✓ import type { Critter, Item } from 'folib'
Use type-only imports for interfaces and type aliases.
sfall
✓ import { sfall } from 'folib'
✗ import { sfall } from 'folib/sfall'
Subpath imports not supported; all exports are from root.

Imports core exports, fetches the player, prints name, and modifies inventory items using sfall flag.

import { fo, Game, sfall } from 'folib'; import { critter, item } from 'folib/types'; const player = Game.getPlayer(); if (player) { fo.printf('Player name: %s', player.name); const inv = player.getInventory(); inv.forEach(i => sfall.setItemFlag(i, 'no_drop', true)); }
Debug
Known issues
deprecatedexport const fo_version = '0.4.0' - use fo.version instead.
fix
Replace fo_version with fo.version.
affects: >=0.4.0 <0.5.0
breakingRemoved default export in v0.4.0. `import fo from 'folib'` no longer works.
fix
Use named import: `import { fo } from 'folib'`.
affects: >=0.4.0
gotchaESLint peer deps are not automatically installed; linting requires manual setup.
fix
Install peer deps: `npm install --save-dev eslint eslint-plugin-unused-imports typescript-eslint`
affects: >=0.4.0
breakingAPI function `sfall.registerHook` was removed; use `sfall.addHook` instead.
fix
Replace `sfall.registerHook(...)` with `sfall.addHook(...)`.
affects: >=0.4.0
Errors
Common errors & fixes
Cannot find module 'folib' or its corresponding type declarations.
Missing npm install or incorrect module resolution.
fix
Run `npm install folib` and ensure `tsconfig.json` includes `node_modules` in module resolution.
Module '"folib"' has no exported member 'fo'.
Attempting default import after v0.4.0.
fix
Use named import: `import { fo } from 'folib'`.
TypeError: Cannot read properties of undefined (reading 'name')
Assuming Game.getPlayer() always returns a valid object.
fix
Check for null/undefined: `const player = Game.getPlayer(); if (player) ...`
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
eslintoptionalpeer dependency for linting configuration
eslint-plugin-unused-importsoptionalpeer dependency for unused import detection
typescript-eslintoptionalpeer dependency for TypeScript ESLint rules
Agent activity
35 hits · last 30 days
node
30
OpenAI (training)
1
Resources
folib — npm install folib · libregistry