npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@league-of-foundry-developers/foundry-vtt-types

v12.331.3-beta

Published

TypeScript type definitions for Foundry VTT

Downloads

12,458

Readme

foundry-vtt-types

TypeScript type definitions for Foundry Virtual Tabletop (unofficial)

League Discord Server npm (tag)

Supported Foundry VTT versions

We aim to support the latest release of each Foundry VTT version (0.7, 0.8, 9, etc.), starting with 0.7.

At the moment, versions 0.7, 0.8, and 9 are fully supported with partial support for versions 10 and 11. Work on support for version 12 is currently underway. See the open foundry V12 issues.

V12 Installation

Currently v12 is still in beta. There are known bugs, issues in the ergonomics, and major unfinished work in the current implementation. To get a direct line of communication about the current status of development as well as to help us understand what areas need to be prioritizated first, join the League of Extraordinary FoundryVTT Developers Discord or file an issue.

The recommended way to install for v12 is this command:

npm add --include=dev github:League-of-Foundry-Developers/foundry-vtt-types#main

Alternatively, if you're using yarn you'll need to use the command yarn add --dev foundry-vtt-types@github:League-of-Foundry-Developers/foundry-vtt-types#main.

This will add the current commit on main as a dependency. Both npm and yarn's lockfile will store the commit you initially installed this command and so updates to your dependency will not happen automatically or even after a fresh install. To update you will need to be rerun the prior command periodically to update as improvements are added frequently.

Installation

You can install historical versions of foundry-vtt-types from the npm registry.

In order to install the latest stable version (v9), run

npm install --save-dev @league-of-foundry-developers/foundry-vtt-types

In order to install a specific version run

npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@<version>

For example, to install version 9.268.0, run

npm install --save-dev @league-of-foundry-developers/[email protected]

You can then update foundry-vtt-types using the regular update mechanism for npm (see npm update).

Versioning scheme

The versions of the foundry-vtt-types correspond to the releases of Foundry VTT. The versioning scheme of Foundry VTT changed with version 9, so the versioning scheme for the foundry-vtt-types also changes with that version:

  • For Foundry VTT version 0.7 and 0.8, the versioning scheme is

    0.<foundy-minor-version>.<foundry-patch-version>-<increment>
  • For Foundry VTT version 9 and onwards, the versioning scheme is

    <foundry-version>.<foundry-build>.<increment>

    In both cases, increment is a number that increases with every individual release of the foundry-vtt-types for that Foundry VTT release.

Usage

Add foundry-vtt-types to your types section in your tsconfig.json:

{
  "compilerOptions": {
    "types": ["@league-of-foundry-developers/foundry-vtt-types"],
    "module": "node16",
    "moduleResolution": "node16",
    "esModuleInterop": true,
    "strictNullChecks": true
  }
}

This will make the type definitions available globally in your project.

Make sure you are using at least "module": "node16" and "moduleResolution": "node16", too. It is required for some imports to be resolved correctly, such as @league-of-foundry-developers/foundry-vtt-types/src/types/utils.mts.

Also make sure to set "strictNullChecks": true because otherwise, some conditional types used in the type definitions resolve incorrectly, and you will see a lot of errors. Alternatively, you can just set "strict": true, which implicitly sets strictNullChecks. This is actually what we recommend, but it's not required.

You can find some information about how to actually work with the type definitions in the Wiki. A good starting point is the FAQ.

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.

Development on the current version of Foundry VTT is done on the main branch. Additionally, we keep branches for the older version of Foundry VTT that we still support. These branches are named according to the Foundry VTT version they correspond to. For example, the branch for Foundry VTT 0.8 is called foundry-0.8.x. All work to improve the type definitions needs to be done through Pull Requests to the relevant 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 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

Creating a release

To create a release, you have to create a new release commit, tag it and create a GitHub release from that. The CI will handle the rest.

npm version <release-type>
git push --follow-tags

License

This project is licensed under the MIT license. You can find a copy at LICENSE.