Shared TypeScript declarations for David Raynes' suite of Foundry Virtual Tabletop modules.
Install the package as a development dependency so your TypeScript project can rely on the published declaration files:
npm install --save-dev @rayners/foundry-module-typesThe package targets Node.js 18+ environments in alignment with Foundry VTT's current requirements.
Import the modules that your project depends on to gain typed access to their public APIs. Every module exports namespaces that mirror the structure of the deployed Foundry modules.
import { Foundry, JourneysAndJamborees, TaskAndTrigger } from '@rayners/foundry-module-types';
function registerSetting(settings: Foundry.ClientSettings) {
settings.register('task-and-trigger', 'autoAssignTasks', {
scope: 'world',
config: true,
type: Boolean,
default: true,
});
}
const travelRoles: JourneysAndJamborees.TravelRole[] = ['pathfinder', 'lookout'];
const reminder: TaskAndTrigger.ModuleTaskScheduling = {
moduleId: 'task-and-trigger',
macroId: 'restock-herbs',
schedule: { days: 7 },
name: 'Restock Herbs',
description: 'Remind the quartermaster to restock herbs every week.',
recurring: true,
interval: { days: 7 },
scope: 'world',
};Available namespaces include:
Foundry– Lightweight primitives that model the Foundry VTT runtime.SeasonsAndStars– Types shared by the Seasons & Stars module.SimpleCalendarCompat– Helpers for interoperability with Simple Calendar.JourneysAndJamborees– Journeys & Jamborees module types.RealmsAndReaches– Shared declarations for the Realms & Reaches module.TaskAndTrigger– Task automation and scheduler primitives.ErrorsAndEchoes– Utilities for the Errors & Echoes module.
Check the src/ directory for the latest source of truth. The compiled
.d.ts files emitted to dist/ are published with each release.
Community contributions are welcome! Please review CONTRIBUTING.md for information on setting up your local environment, coding standards, and required checks before opening a pull request.
This project is distributed under the terms of the MIT License.