@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250801172911 → 13.346.0-beta.20250803184428

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.20250801172911",
4
+ "version": "13.346.0-beta.20250803184428",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -1,6 +1,7 @@
1
1
  import type { DeepPartial, InterfaceToObject, MaybeEmpty } from "#utils";
2
2
  import type { fields } from "../foundry/common/data/_module.d.mts";
3
3
  import type Document from "../foundry/common/abstract/document.d.mts";
4
+ import type * as documents from "./documents.d.mts";
4
5
 
5
6
  import AVSettings = foundry.av.AVSettings;
6
7
  import Game = foundry.Game;
@@ -68,6 +69,35 @@ export interface AssumeHookRan {}
68
69
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
69
70
  export interface DocumentClassConfig {}
70
71
 
72
+ /**
73
+ * Experimental: This config exists to stymy circularities.
74
+ */
75
+ export interface DocumentInstanceConfig extends GetConfigured<_DocumentInstanceConfig> {}
76
+
77
+ interface _DocumentInstanceConfig {
78
+ ActiveEffect: documents.ConfiguredActiveEffect<ActiveEffect.SubType>;
79
+ ActorDelta: documents.ConfiguredActorDelta<ActorDelta.SubType>;
80
+ Actor: documents.ConfiguredActor<Actor.SubType>;
81
+ Card: documents.ConfiguredCard<Card.SubType>;
82
+ Cards: documents.ConfiguredCards<Cards.SubType>;
83
+ ChatMessage: documents.ConfiguredChatMessage<ChatMessage.SubType>;
84
+ Combat: documents.ConfiguredCombat<Combat.SubType>;
85
+ Combatant: documents.ConfiguredCombatant<Combatant.SubType>;
86
+ CombatantGroup: documents.ConfiguredCombatantGroup<CombatantGroup.SubType>;
87
+ Folder: documents.ConfiguredFolder<Folder.SubType>;
88
+ Item: documents.ConfiguredItem<Item.SubType>;
89
+ JournalEntryPage: documents.ConfiguredJournalEntryPage<JournalEntryPage.SubType>;
90
+ Macro: documents.ConfiguredMacro<Macro.SubType>;
91
+ RegionBehavior: documents.ConfiguredRegionBehavior<RegionBehavior.SubType>;
92
+ TableResult: documents.ConfiguredTableResult<TableResult.SubType>;
93
+ }
94
+
95
+ type GetConfigured<T> = {
96
+ [K in keyof T as T[K] extends { document: unknown } ? K : never]: T[K] extends { document: infer Document }
97
+ ? Document
98
+ : never;
99
+ };
100
+
71
101
  /**
72
102
  * This interface is used to configure the used object classes at a type
73
103
  * level. Module and system authors should use declaration merging to provide
@@ -7,6 +7,7 @@ import * as configuration from "#configuration";
7
7
  declare global {
8
8
  interface AssumeHookRan extends configuration.AssumeHookRan {}
9
9
  interface DocumentClassConfig extends configuration.DocumentClassConfig {}
10
+ interface DocumentInstanceConfig extends configuration.DocumentInstanceConfig {}
10
11
  interface PlaceableObjectClassConfig extends configuration.PlaceableObjectClassConfig {}
11
12
  interface DataConfig extends configuration.DataConfig {}
12
13
  interface GetDataConfig extends configuration.GetDataConfig {}
@@ -96,9 +96,11 @@ type GetDocumentClass<ConcreteDocumentType extends Document.Type> =
96
96
  : DefaultDocumentClasses[ConcreteDocumentType];
97
97
 
98
98
  type GetDocumentInstance<ConcreteDocumentType extends Document.Type> =
99
- ConcreteDocumentType extends keyof DocumentClassConfig
100
- ? FixedInstanceType<DocumentClassConfig[ConcreteDocumentType]>
101
- : DefaultDocumentInstance[ConcreteDocumentType];
99
+ ConcreteDocumentType extends keyof DocumentInstanceConfig
100
+ ? DocumentInstanceConfig[ConcreteDocumentType]
101
+ : ConcreteDocumentType extends keyof DocumentClassConfig
102
+ ? FixedInstanceType<DocumentClassConfig[ConcreteDocumentType]>
103
+ : DefaultDocumentInstance[ConcreteDocumentType];
102
104
 
103
105
  // This interface exists as a way to catch circular errors easier.
104
106
  // This makes it more verbose than it might seem it has to be but it's important to stay this way.