foundry-vtt-types
TypeScript type definitions for Foundry Virtual Tabletop (unofficial)
Supported Foundry VTT versions
At the moment, only 0.7.9 is supported. Work on 0.8.0 is in the pipeline.
Installation
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).
Usage
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.
Acknowledgments
Originally forked from Foundry Project Creator Types by @NickEastNL
Contributing
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.
Type-Checking, Linting, Testing
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
License
This project is licensed under the MIT license. You can find a copy at LICENSE.