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

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.20250803190002",
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
@@ -4,6 +4,7 @@
4
4
  import type { documents } from "../foundry/client/client.d.mts";
5
5
  import type { Document } from "../foundry/common/abstract/_module.d.mts";
6
6
  import type { InterfaceToObject, MakeConform, MustConform, FixedInstanceType } from "#utils";
7
+ import type * as configuration from "#configuration";
7
8
 
8
9
  type DocumentConform<T> = MakeConform<T, Document.AnyConstructor>;
9
10
 
@@ -96,9 +97,11 @@ type GetDocumentClass<ConcreteDocumentType extends Document.Type> =
96
97
  : DefaultDocumentClasses[ConcreteDocumentType];
97
98
 
98
99
  type GetDocumentInstance<ConcreteDocumentType extends Document.Type> =
99
- ConcreteDocumentType extends keyof DocumentClassConfig
100
- ? FixedInstanceType<DocumentClassConfig[ConcreteDocumentType]>
101
- : DefaultDocumentInstance[ConcreteDocumentType];
100
+ ConcreteDocumentType extends keyof configuration.DocumentInstanceConfig
101
+ ? configuration.DocumentInstanceConfig[ConcreteDocumentType]
102
+ : ConcreteDocumentType extends keyof DocumentClassConfig
103
+ ? FixedInstanceType<DocumentClassConfig[ConcreteDocumentType]>
104
+ : DefaultDocumentInstance[ConcreteDocumentType];
102
105
 
103
106
  // This interface exists as a way to catch circular errors easier.
104
107
  // This makes it more verbose than it might seem it has to be but it's important to stay this way.