{"id":27002,"library":"folib","title":"FOlib","description":"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.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","Fallout","Fallout 2","sfall","TSSL"],"install":[{"cmd":"npm install folib","lang":"bash","label":"npm"},{"cmd":"yarn add folib","lang":"bash","label":"yarn"},{"cmd":"pnpm add folib","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for linting configuration","package":"eslint","optional":true},{"reason":"peer dependency for unused import detection","package":"eslint-plugin-unused-imports","optional":true},{"reason":"peer dependency for TypeScript ESLint rules","package":"typescript-eslint","optional":true}],"imports":[{"note":"fo is a named export, not default.","wrong":"import fo from 'folib'","symbol":"fo","correct":"import { fo } from 'folib'"},{"note":"ESM-only; no CommonJS support.","wrong":"const Game = require('folib').Game","symbol":"Game","correct":"import { Game } from 'folib'"},{"note":"Use type-only imports for interfaces and type aliases.","symbol":"types","correct":"import type { Critter, Item } from 'folib'"},{"note":"Subpath imports not supported; all exports are from root.","wrong":"import { sfall } from 'folib/sfall'","symbol":"sfall","correct":"import { sfall } from 'folib'"}],"quickstart":{"code":"import { fo, Game, sfall } from 'folib';\nimport { critter, item } from 'folib/types';\n\nconst player = Game.getPlayer();\nif (player) {\n  fo.printf('Player name: %s', player.name);\n  const inv = player.getInventory();\n  inv.forEach(i => sfall.setItemFlag(i, 'no_drop', true));\n}","lang":"typescript","description":"Imports core exports, fetches the player, prints name, and modifies inventory items using sfall flag."},"warnings":[{"fix":"Replace fo_version with fo.version.","message":"export const fo_version = '0.4.0' - use fo.version instead.","severity":"deprecated","affected_versions":">=0.4.0 <0.5.0"},{"fix":"Use named import: `import { fo } from 'folib'`.","message":"Removed default export in v0.4.0. `import fo from 'folib'` no longer works.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Install peer deps: `npm install --save-dev eslint eslint-plugin-unused-imports typescript-eslint`","message":"ESLint peer deps are not automatically installed; linting requires manual setup.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Replace `sfall.registerHook(...)` with `sfall.addHook(...)`.","message":"API function `sfall.registerHook` was removed; use `sfall.addHook` instead.","severity":"breaking","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install folib` and ensure `tsconfig.json` includes `node_modules` in module resolution.","cause":"Missing npm install or incorrect module resolution.","error":"Cannot find module 'folib' or its corresponding type declarations."},{"fix":"Use named import: `import { fo } from 'folib'`.","cause":"Attempting default import after v0.4.0.","error":"Module '\"folib\"' has no exported member 'fo'."},{"fix":"Check for null/undefined: `const player = Game.getPlayer(); if (player) ...`","cause":"Assuming Game.getPlayer() always returns a valid object.","error":"TypeError: Cannot read properties of undefined (reading 'name')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}