@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250704113344 → 13.346.0-beta.20250704132251

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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/src/configuration/configuration.d.mts +3 -3
  3. package/src/foundry/client/applications/dice/roll-resolver.d.mts +2 -2
  4. package/src/foundry/client/canvas/layers/base/placeables-layer.d.mts +2 -13
  5. package/src/foundry/client/canvas/layers/tokens.d.mts +0 -6
  6. package/src/foundry/client/canvas/layers/walls.d.mts +0 -7
  7. package/src/foundry/client/documents/abstract/world-collection.d.mts +12 -9
  8. package/src/foundry/client/documents/actor-delta.d.mts +2 -2
  9. package/src/foundry/client/documents/actor.d.mts +1 -1
  10. package/src/foundry/client/documents/cards.d.mts +7 -1
  11. package/src/foundry/common/abstract/document.d.mts +5 -1
  12. package/src/foundry/common/data/fields.d.mts +3 -3
  13. package/src/foundry/common/documents/active-effect.d.mts +2 -0
  14. package/src/foundry/common/documents/actor-delta.d.mts +6 -0
  15. package/src/foundry/common/documents/actor.d.mts +2 -0
  16. package/src/foundry/common/documents/card.d.mts +2 -0
  17. package/src/foundry/common/documents/cards.d.mts +2 -0
  18. package/src/foundry/common/documents/chat-message.d.mts +2 -0
  19. package/src/foundry/common/documents/combat.d.mts +2 -0
  20. package/src/foundry/common/documents/combatant-group.d.mts +2 -0
  21. package/src/foundry/common/documents/combatant.d.mts +2 -0
  22. package/src/foundry/common/documents/folder.d.mts +3 -1
  23. package/src/foundry/common/documents/item.d.mts +2 -0
  24. package/src/foundry/common/documents/macro.d.mts +3 -1
  25. package/src/foundry/common/documents/region-behavior.d.mts +2 -0
  26. package/src/foundry/common/documents/table-result.d.mts +3 -1
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.20250704113344",
4
+ "version": "13.346.0-beta.20250704132251",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -314,9 +314,9 @@ export interface SettingConfig {
314
314
  choices: InterfaceToObject<typeof CONFIG.Dice.rollModes>;
315
315
  },
316
316
  // Note(LukeAbby): This override is necessary because the `initial` wasn't removing `null`.
317
- (string & keyof typeof CONFIG.Dice.rollModes) | null | undefined,
318
- string & keyof typeof CONFIG.Dice.rollModes,
319
- string & keyof typeof CONFIG.Dice.rollModes
317
+ CONFIG.Dice.RollMode | null | undefined,
318
+ CONFIG.Dice.RollMode,
319
+ CONFIG.Dice.RollMode
320
320
  >;
321
321
  "core.rtcClientSettings": typeof AVSettings.schemaFields.client;
322
322
  "core.rtcWorldSettings": typeof AVSettings.schemaFields.world;
@@ -114,8 +114,8 @@ declare namespace RollResolver {
114
114
  }
115
115
 
116
116
  interface Result {
117
- denomination: DiceTerm.Any;
118
- faces: DiceTerm.Any;
117
+ denomination: string;
118
+ faces: number | undefined;
119
119
  id: string;
120
120
  method: string;
121
121
  icon: string;
@@ -308,19 +308,8 @@ declare class PlaceablesLayer<out DocumentName extends PlaceablesLayer.DocumentN
308
308
  options?: PlaceablesLayer.PasteOptions, // not:null (destructured)
309
309
  ): Promise<Document.ImplementationFor<DocumentName>[]>;
310
310
 
311
- /**
312
- * Get the data of the copied object pasted at the position given by the offset.
313
- * Called by {@link PlaceablesLayer.pasteObjects | `PlaceablesLayer#pasteObjects`} for each copied object.
314
- * @param copy - The copied object that is pasted
315
- * @param offset - The offset relative from the current position to the destination
316
- * @param options - Options of {@link PlaceablesLayer.pasteObjects | `PlaceablesLayer#pasteObjects`}
317
- * @returns The update data
318
- */
319
- protected _pasteObject(
320
- copy: Document.ObjectFor<DocumentName>,
321
- offset: Canvas.Point,
322
- options?: PlaceablesLayer.PasteOptions, // not:null (destructured)
323
- ): Omit<Document.ImplementationFor<DocumentName>["_source"], "_id">;
311
+ /** @deprecated Foundry deleted this method in v13 (this warning will be removed in v14) */
312
+ protected _pasteObject(copy: never, offset: never, options?: never): never;
324
313
 
325
314
  /**
326
315
  * Select all PlaceableObject instances which fall within a coordinate rectangle.
@@ -78,12 +78,6 @@ declare class TokenLayer extends PlaceablesLayer<"Token"> {
78
78
 
79
79
  protected override _deactivate(): void;
80
80
 
81
- protected override _pasteObject(
82
- copy: Token.Implementation,
83
- offset: Canvas.Point,
84
- options?: PlaceablesLayer.PasteOptions, // not:null (destructured)
85
- ): Omit<TokenDocument.Source, "_id">;
86
-
87
81
  /** @remarks Returns `[]` if the ruler is currently measuring */
88
82
  protected override _getMovableObjects(ids?: string[] | null, includeLocked?: boolean | null): Token.Implementation[];
89
83
 
@@ -90,13 +90,6 @@ declare class WallsLayer extends PlaceablesLayer<"Wall"> {
90
90
 
91
91
  override releaseAll(options?: PlaceableObject.ReleaseOptions): number;
92
92
 
93
- /** @remarks `options` is unused */
94
- protected override _pasteObject(
95
- copy: Wall.Implementation,
96
- offset: Canvas.Point,
97
- options?: PlaceablesLayer.PasteOptions | null,
98
- ): Omit<WallDocument.Source, "_id">;
99
-
100
93
  /**
101
94
  * Pan the canvas view when the cursor position gets close to the edge of the frame
102
95
  * @param event - The originating mouse movement event
@@ -32,15 +32,7 @@ declare abstract class WorldCollection<
32
32
  * In the case where `Lowercase<Name>` is not a property of {@linkcode ui}, this actually always returns `undefined`,
33
33
  * but {@linkcode RollTables} overrides this, so we need to allow a wider return type.
34
34
  */
35
- get directory(): Lowercase<Name> extends keyof typeof ui
36
- ? (typeof ui)[Lowercase<Name>]
37
- :
38
- | (DocumentName extends foundry.CONST.FOLDER_DOCUMENT_TYPES
39
- ? DocumentDirectory<Document.ImplementationClassFor<DocumentName>>
40
- : never)
41
- | AbstractSidebarTab.Any
42
- | undefined
43
- | null;
35
+ get directory(): WorldCollection.Directory<DocumentName, Name>;
44
36
 
45
37
  /**
46
38
  * Return a reference to the singleton instance of this WorldCollection, or null if it has not yet been created.
@@ -139,6 +131,17 @@ declare namespace WorldCollection {
139
131
  DocumentName extends Folder.DocumentType ? Folder.Stored<DocumentName> : never
140
132
  >;
141
133
 
134
+ type Directory<DocumentName extends Document.WorldType, Name extends string> =
135
+ Lowercase<Name> extends keyof typeof ui
136
+ ? (typeof ui)[Lowercase<Name>]
137
+ :
138
+ | (DocumentName extends foundry.CONST.FOLDER_DOCUMENT_TYPES
139
+ ? DocumentDirectory<Document.ImplementationClassFor<DocumentName>>
140
+ : never)
141
+ | AbstractSidebarTab.Any
142
+ | undefined
143
+ | null;
144
+
142
145
  interface FromCompendiumOptions {
143
146
  /**
144
147
  * Clear the currently assigned folder
@@ -549,9 +549,9 @@ declare class ActorDelta<out SubType extends ActorDelta.SubType = ActorDelta.Sub
549
549
  protected override _initialize(options?: ActorDelta.InitializeOptions): void;
550
550
 
551
551
  /** Pass-through the type from the synthetic Actor, if it exists. */
552
- get type(): string;
552
+ get type(): SubType;
553
553
 
554
- set type(type: string);
554
+ set type(type);
555
555
 
556
556
  protected _type: string;
557
557
 
@@ -708,7 +708,7 @@ declare class Actor<out SubType extends Actor.SubType = Actor.SubType> extends f
708
708
  /**
709
709
  * Provide a thumbnail image path used to represent this document.
710
710
  */
711
- get thumbnail(): string;
711
+ get thumbnail(): string | null;
712
712
 
713
713
  /**
714
714
  * A convenience getter to an object that organizes all embedded Item instances by subtype. The object is cached and
@@ -686,7 +686,13 @@ declare namespace Cards {
686
686
  * which wouldn't make sense to change, then passes that to {@link Cards.pass | `Cards#pass`}
687
687
  * @privateRemarks `action` omitted as it's already provided.
688
688
  */
689
- interface DrawOptions extends _HowOption, Omit<PassOptions, "action"> {}
689
+ interface DrawOptions extends _HowOption, Omit<PassOptions, "action"> {
690
+ /**
691
+ * @deprecated While passing `action` is technically valid, it's unclear why this would ever be done.
692
+ * If you need to do this call `this.parent.pass` directly.
693
+ */
694
+ action?: never;
695
+ }
690
696
 
691
697
  interface ShuffleOptions extends _UpdateDataOption, _ChatNotificationOption {}
692
698
 
@@ -1158,12 +1158,14 @@ declare namespace Document {
1158
1158
  | (SubType extends ModuleSubType | "base" ? UnknownSystem : never);
1159
1159
 
1160
1160
  // TODO(LukeAbby): Improve the type display with a helper here.
1161
+ // TODO(LukeAbby): Add `StoredSource` for a better type display there.
1161
1162
  type Stored<D extends Document.Any> = Override<
1162
1163
  D,
1163
1164
  {
1164
1165
  id: string;
1165
1166
  _id: string;
1166
1167
  _source: Override<D["_source"], { _id: string }>;
1168
+ toJSON(): Override<D["_source"], { _id: string }>;
1167
1169
  }
1168
1170
  >;
1169
1171
 
@@ -1419,7 +1421,9 @@ declare namespace Document {
1419
1421
  type MetadataFor<Name extends Document.Type> = ConfiguredMetadata[Name];
1420
1422
 
1421
1423
  type CollectionRecord<Schema extends DataSchema> = {
1422
- [Key in keyof Schema]: Schema[Key] extends EmbeddedCollectionField.Any ? Schema[Key] : never;
1424
+ [Key in keyof Schema]: Schema[Key] extends EmbeddedCollectionField.Any
1425
+ ? NonNullable<Schema[Key][" __fvtt_types_internal_initialized_data"]>
1426
+ : never;
1423
1427
  };
1424
1428
 
1425
1429
  type Flags<ConcreteDocument extends Internal.Instance.Any> = OptionsForSchema<SchemaFor<ConcreteDocument>>;
@@ -1305,10 +1305,10 @@ declare namespace SchemaField {
1305
1305
  declare class BooleanField<
1306
1306
  const Options extends BooleanField.Options = BooleanField.DefaultOptions,
1307
1307
  // eslint-disable-next-line @typescript-eslint/no-deprecated
1308
- const AssignmentType = BooleanField.AssignmentType<SimpleMerge<Options, BooleanField.DefaultOptions>>,
1309
- const InitializedType = BooleanField.InitializedType<SimpleMerge<Options, BooleanField.DefaultOptions>>,
1308
+ const AssignmentType = BooleanField.AssignmentType<SimpleMerge<BooleanField.DefaultOptions, Options>>,
1309
+ const InitializedType = BooleanField.InitializedType<SimpleMerge<BooleanField.DefaultOptions, Options>>,
1310
1310
  const PersistedType extends boolean | null | undefined = BooleanField.InitializedType<
1311
- SimpleMerge<Options, BooleanField.DefaultOptions>
1311
+ SimpleMerge<BooleanField.DefaultOptions, Options>
1312
1312
  >,
1313
1313
  > extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
1314
1314
  /** @defaultValue `true` */
@@ -89,6 +89,8 @@ declare abstract class BaseActiveEffect<
89
89
  * separate like this helps against circularities.
90
90
  */
91
91
 
92
+ type: SubType;
93
+
92
94
  /* Document overrides */
93
95
 
94
96
  // Same as Document for now
@@ -112,6 +112,12 @@ declare abstract class BaseActorDelta<
112
112
  * separate like this helps against circularities.
113
113
  */
114
114
 
115
+ // This is technically a property in this class but in the interest of avoiding an error it's been
116
+ // made a getter/setter pair.
117
+ get type(): SubType;
118
+
119
+ set type(type);
120
+
115
121
  /* Document overrides */
116
122
 
117
123
  // Same as Document for now
@@ -110,6 +110,8 @@ declare abstract class BaseActor<out SubType extends Actor.SubType = Actor.SubTy
110
110
  * separate like this helps against circularities.
111
111
  */
112
112
 
113
+ type: SubType;
114
+
113
115
  /* Document overrides */
114
116
 
115
117
  // Same as Document for now
@@ -72,6 +72,8 @@ declare abstract class BaseCard<out SubType extends BaseCard.SubType = BaseCard.
72
72
  * separate like this helps against circularities.
73
73
  */
74
74
 
75
+ type: SubType;
76
+
75
77
  /* Document overrides */
76
78
 
77
79
  // Same as Document for now
@@ -86,6 +86,8 @@ declare abstract class BaseCards<out SubType extends BaseCards.SubType = BaseCar
86
86
  * separate like this helps against circularities.
87
87
  */
88
88
 
89
+ type: SubType;
90
+
89
91
  /* Document overrides */
90
92
 
91
93
  // Same as Document for now
@@ -84,6 +84,8 @@ declare abstract class BaseChatMessage<
84
84
  * separate like this helps against circularities.
85
85
  */
86
86
 
87
+ type: SubType;
88
+
87
89
  /* Document overrides */
88
90
 
89
91
  override readonly parentCollection: ChatMessage.ParentCollectionName | null;
@@ -89,6 +89,8 @@ declare abstract class BaseCombat<out SubType extends BaseCombat.SubType = BaseC
89
89
  * separate like this helps against circularities.
90
90
  */
91
91
 
92
+ type: SubType;
93
+
92
94
  /* Document overrides */
93
95
 
94
96
  // Same as Document for now
@@ -55,6 +55,8 @@ declare abstract class BaseCombatantGroup<
55
55
  * separate like this helps against circularities.
56
56
  */
57
57
 
58
+ type: SubType;
59
+
58
60
  /* Document overrides */
59
61
 
60
62
  // Same as Document for now
@@ -70,6 +70,8 @@ declare abstract class BaseCombatant<
70
70
  * separate like this helps against circularities.
71
71
  */
72
72
 
73
+ type: SubType;
74
+
73
75
  /* Document overrides */
74
76
 
75
77
  // Same as Document for now
@@ -11,7 +11,7 @@ import type { LogCompatibilityWarningOptions } from "../utils/logging.d.mts";
11
11
  // Note(LukeAbby): You may wonder why documents don't simply pass the `Parent` generic parameter.
12
12
  // This pattern evolved from trying to avoid circular loops and even internal tsc errors.
13
13
  // See: https://gist.github.com/LukeAbby/0d01b6e20ef19ebc304d7d18cef9cc21
14
- declare abstract class BaseFolder<out _SubType extends BaseFolder.SubType = BaseFolder.SubType> extends Document<
14
+ declare abstract class BaseFolder<out SubType extends BaseFolder.SubType = BaseFolder.SubType> extends Document<
15
15
  "Folder",
16
16
  BaseFolder.Schema,
17
17
  any
@@ -76,6 +76,8 @@ declare abstract class BaseFolder<out _SubType extends BaseFolder.SubType = Base
76
76
  * separate like this helps against circularities.
77
77
  */
78
78
 
79
+ type: SubType;
80
+
79
81
  /* Document overrides */
80
82
 
81
83
  // Same as Document for now
@@ -93,6 +93,8 @@ declare abstract class BaseItem<out SubType extends Item.SubType = Item.SubType>
93
93
  * separate like this helps against circularities.
94
94
  */
95
95
 
96
+ type: SubType;
97
+
96
98
  /* Document overrides */
97
99
 
98
100
  // Same as Document for now
@@ -11,7 +11,7 @@ import type { LogCompatibilityWarningOptions } from "../utils/logging.d.mts";
11
11
  // Note(LukeAbby): You may wonder why documents don't simply pass the `Parent` generic parameter.
12
12
  // This pattern evolved from trying to avoid circular loops and even internal tsc errors.
13
13
  // See: https://gist.github.com/LukeAbby/0d01b6e20ef19ebc304d7d18cef9cc21
14
- declare abstract class BaseMacro<out _SubType extends BaseMacro.SubType = BaseMacro.SubType> extends Document<
14
+ declare abstract class BaseMacro<out SubType extends BaseMacro.SubType = BaseMacro.SubType> extends Document<
15
15
  "Macro",
16
16
  BaseMacro.Schema,
17
17
  any
@@ -101,6 +101,8 @@ declare abstract class BaseMacro<out _SubType extends BaseMacro.SubType = BaseMa
101
101
  * separate like this helps against circularities.
102
102
  */
103
103
 
104
+ type: SubType;
105
+
104
106
  /* Document overrides */
105
107
 
106
108
  override readonly parentCollection: Macro.ParentCollectionName | null;
@@ -73,6 +73,8 @@ declare abstract class BaseRegionBehavior<
73
73
  * separate like this helps against circularities.
74
74
  */
75
75
 
76
+ type: SubType;
77
+
76
78
  /* Document overrides */
77
79
 
78
80
  // Same as Document for now
@@ -12,7 +12,7 @@ import type { LogCompatibilityWarningOptions } from "../utils/logging.d.mts";
12
12
  // This pattern evolved from trying to avoid circular loops and even internal tsc errors.
13
13
  // See: https://gist.github.com/LukeAbby/0d01b6e20ef19ebc304d7d18cef9cc21
14
14
  declare abstract class BaseTableResult<
15
- out _SubType extends BaseTableResult.SubType = BaseTableResult.SubType,
15
+ out SubType extends BaseTableResult.SubType = BaseTableResult.SubType,
16
16
  > extends Document<"TableResult", BaseTableResult.Schema, any> {
17
17
  /**
18
18
  * @param data - Initial data from which to construct the `BaseTableResult`
@@ -87,6 +87,8 @@ declare abstract class BaseTableResult<
87
87
  * separate like this helps against circularities.
88
88
  */
89
89
 
90
+ type: SubType;
91
+
90
92
  /* Document overrides */
91
93
 
92
94
  // Same as Document for now