TypeScript type definitions for Foundry Virtual Tabletop (unofficial)
At the moment, only 0.7.9 is supported. Work on 0.8.x is in progress but there is still a lot to be done.
You can install foundry-vtt-types from the npm registry. We provide distribution tags for the different supported Foundry VTT versions that have the form fvtt-<foundry-version>
. For example, the distribution tag for Foundry VTT 0.7.9 is fvtt-0.7.9
.
In order to install the desired version, run
npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@fvtt-<foundry-version>
For example, to install the type definitions for Foundry VTT 0.7.9, run
npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@fvtt-0.7.9
You can then update foundry-vtt-types using the regular update mechanism for npm (see npm update).
Add foundry-vtt-types to your types section in your tsconfig.json
:
{
"compilerOptions": {
"types": ["@league-of-foundry-developers/foundry-vtt-types"],
"moduleResolution": "node"
}
}
This will make the type definitions available globally in your project.
Make sure you are using "moduleResolution": "node"
, too. It is required for some dependencies to be resolved correctly.
You can find some information about how to actually work with the type definitions in the Wiki. For example, [0.7.9] Actors and Items describes how to set up custom Actor
and Item
classes for 0.7.9 using the types.
Originally forked from Foundry Project Creator Types by @NickEastNL
Contributions are very welcome in order to decrease the individual workload. Filing issues for wrong / missing types is also a great way to help us improve the type definitions.
There are individual branches for the different supported Foundry VTT versions that are being worked on. They are named according to the Foundry VTT version, e.g. the branch for Foundry VTT 0.7.9 is called foundry-0.7.9
. All work to improve the type definitions for a specific version needs to be done through Pull Requests to the corresponding branch.
Please read CONTRIBUTING.md for more details on how to contribute.
If you have any specific questions, feel free to contact us in the League of Extraordinary Foundry Developers Discord.
When contributing, make sure sure that the type checks pass, the linter is green and the tests are green. We do have checks in the CI but running this locally also helps you while developing and saves you time as you don't have to wait for the CI.
You can run type checking and linting with the following command:
npm run lint
You can run the tests with
npm run test
This project is licensed under the MIT license. You can find a copy at LICENSE.