@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250724175652 → 13.346.0-beta.20250724185242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@league-of-foundry-developers/foundry-vtt-types",
4
- "version": "13.346.0-beta.20250724175652",
4
+ "version": "13.346.0-beta.20250724185242",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -1,17 +1,11 @@
1
1
  import type { Socket } from "socket.io-client";
2
- import type {
3
- ConfiguredModule,
4
- ValueOf,
5
- FixedInstanceType,
6
- InitializationHook,
7
- InitializedOn,
8
- EmptyObject,
9
- } from "#utils";
2
+ import type { ValueOf, FixedInstanceType, InitializationHook, InitializedOn, EmptyObject, GetKey } from "#utils";
10
3
  import type BasePackage from "#common/packages/base-package.d.mts";
11
4
  import type { Document } from "#common/abstract/_module.d.mts";
12
5
  import type { Canvas } from "#client/canvas/_module.d.mts";
13
6
 
14
7
  import AVMaster = foundry.av.AVMaster;
8
+ import Module = foundry.packages.Module;
15
9
 
16
10
  // Must be called with all hooks in a union.
17
11
  // Do not increase the complexity of this type. If you do Game related types may get complex enough to complain about not being statically known.
@@ -627,16 +621,38 @@ declare global {
627
621
  }
628
622
 
629
623
  declare namespace Game {
630
- interface ModuleCollection extends Collection<foundry.packages.Module> {
624
+ interface ModuleCollection extends Collection<foundry.packages.Module, ModuleCollectionMethods> {}
625
+
626
+ interface ModuleCollectionMethods {
631
627
  /**
632
- * Gets the module requested for by ID
633
- * @see {@linkcode ModuleConfig} to add custom properties to modules like APIs.
628
+ * @remarks Gets the module requested for by ID
629
+ * @see {@linkcode ModuleConfig} to add custom properties to modules, for example APIs.
634
630
  * @see {@linkcode RequiredModules} to remove `undefined` from the return type for a given module
635
631
  * @param id - The module ID to look up
636
632
  */
637
- get<T extends string>(id: T): foundry.packages.Module & ConfiguredModule<T>;
633
+ get<T extends string, Options extends Collection.GetOptions | undefined = undefined>(
634
+ id: T,
635
+ { strict }?: Options,
636
+ ): _ModuleCollectionGet<T, Options>;
638
637
  }
639
638
 
639
+ /** @internal */
640
+ type _ModuleCollectionGet<
641
+ Name extends string,
642
+ Options extends Collection.GetOptions | undefined = undefined,
643
+ > = Name extends keyof RequiredModules ? _Module<Name> : Collection.GetReturnType<_MaybeActiveModule<Name>, Options>;
644
+
645
+ /** @internal */
646
+ type _Module<Name extends string> =
647
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
648
+ { active: true } & Module & GetKey<ModuleConfig, Name, {}>;
649
+
650
+ /** @internal */
651
+ type _MaybeActiveModule<Name extends string> =
652
+ | _Module<Name>
653
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
654
+ | ({ active: false } & Module & { [K in keyof GetKey<ModuleConfig, Name, {}>]?: never });
655
+
640
656
  namespace Model {
641
657
  /**
642
658
  * Get the configured core and system type names for a specific document type.
@@ -1,7 +1,5 @@
1
1
  import type { Document } from "../foundry/common/abstract/_module.d.mts";
2
2
 
3
- export {};
4
-
5
3
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
6
4
  type ConfiguredModuleData<Name extends string> = Name extends keyof ModuleConfig ? ModuleConfig[Name] : {};
7
5
 
@@ -15,6 +13,7 @@ export type FixedInstanceType<T extends abstract new (...args: never) => any> =
15
13
  ? R
16
14
  : never;
17
15
 
16
+ /** @deprecated Replaced with {@linkcode foundry.packages.Module.ForName | Module.ForName}, will be removed in v14 */
18
17
  export type ConfiguredModule<Name extends string> = Name extends keyof RequiredModules
19
18
  ? ConfiguredModuleData<Name>
20
19
  :