@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250705112003 → 13.346.0-beta.20250705141556

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 (84) hide show
  1. package/package.json +9 -4
  2. package/src/configuration/hooks.d.mts +1 -1
  3. package/src/foundry/client/applications/api/document-sheet.d.mts +8 -1
  4. package/src/foundry/client/applications/api/handlebars-application.d.mts +2 -2
  5. package/src/foundry/client/applications/sheets/ambient-light-config.d.mts +2 -2
  6. package/src/foundry/client/applications/sheets/region-behavior-config.d.mts +1 -1
  7. package/src/foundry/client/documents/abstract/document-collection.d.mts +6 -4
  8. package/src/foundry/client/documents/active-effect.d.mts +12 -5
  9. package/src/foundry/client/documents/actor-delta.d.mts +12 -5
  10. package/src/foundry/client/documents/actor.d.mts +12 -5
  11. package/src/foundry/client/documents/adventure.d.mts +12 -5
  12. package/src/foundry/client/documents/ambient-light.d.mts +12 -5
  13. package/src/foundry/client/documents/ambient-sound.d.mts +12 -5
  14. package/src/foundry/client/documents/card.d.mts +11 -6
  15. package/src/foundry/client/documents/cards.d.mts +13 -6
  16. package/src/foundry/client/documents/chat-message.d.mts +15 -8
  17. package/src/foundry/client/documents/collections/compendium-collection.d.mts +2 -0
  18. package/src/foundry/client/documents/combat.d.mts +12 -5
  19. package/src/foundry/client/documents/combatant-group.d.mts +12 -5
  20. package/src/foundry/client/documents/combatant.d.mts +12 -5
  21. package/src/foundry/client/documents/drawing.d.mts +12 -5
  22. package/src/foundry/client/documents/fog-exploration.d.mts +12 -5
  23. package/src/foundry/client/documents/folder.d.mts +13 -6
  24. package/src/foundry/client/documents/item.d.mts +10 -5
  25. package/src/foundry/client/documents/journal-entry-category.d.mts +12 -5
  26. package/src/foundry/client/documents/journal-entry-page.d.mts +12 -5
  27. package/src/foundry/client/documents/journal-entry.d.mts +12 -5
  28. package/src/foundry/client/documents/macro.d.mts +12 -5
  29. package/src/foundry/client/documents/measured-template.d.mts +12 -5
  30. package/src/foundry/client/documents/note.d.mts +12 -5
  31. package/src/foundry/client/documents/playlist-sound.d.mts +12 -5
  32. package/src/foundry/client/documents/playlist.d.mts +12 -5
  33. package/src/foundry/client/documents/region-behavior.d.mts +12 -5
  34. package/src/foundry/client/documents/region.d.mts +12 -5
  35. package/src/foundry/client/documents/roll-table.d.mts +13 -6
  36. package/src/foundry/client/documents/scene.d.mts +12 -5
  37. package/src/foundry/client/documents/setting.d.mts +8 -1
  38. package/src/foundry/client/documents/table-result.d.mts +12 -5
  39. package/src/foundry/client/documents/tile.d.mts +12 -5
  40. package/src/foundry/client/documents/token.d.mts +15 -12
  41. package/src/foundry/client/documents/user.d.mts +10 -5
  42. package/src/foundry/client/documents/wall.d.mts +12 -5
  43. package/src/foundry/client/helpers/client-settings.d.mts +7 -3
  44. package/src/foundry/common/abstract/document.d.mts +98 -50
  45. package/src/foundry/common/abstract/type-data.d.mts +35 -10
  46. package/src/foundry/common/data/data.d.mts +2 -2
  47. package/src/foundry/common/data/fields.d.mts +71 -59
  48. package/src/foundry/common/documents/active-effect.d.mts +6 -5
  49. package/src/foundry/common/documents/actor-delta.d.mts +6 -5
  50. package/src/foundry/common/documents/actor.d.mts +6 -5
  51. package/src/foundry/common/documents/adventure.d.mts +6 -5
  52. package/src/foundry/common/documents/ambient-light.d.mts +6 -5
  53. package/src/foundry/common/documents/ambient-sound.d.mts +6 -5
  54. package/src/foundry/common/documents/card.d.mts +6 -5
  55. package/src/foundry/common/documents/cards.d.mts +6 -5
  56. package/src/foundry/common/documents/chat-message.d.mts +6 -5
  57. package/src/foundry/common/documents/combat.d.mts +6 -5
  58. package/src/foundry/common/documents/combatant-group.d.mts +6 -5
  59. package/src/foundry/common/documents/combatant.d.mts +6 -5
  60. package/src/foundry/common/documents/drawing.d.mts +6 -5
  61. package/src/foundry/common/documents/fog-exploration.d.mts +6 -5
  62. package/src/foundry/common/documents/folder.d.mts +6 -5
  63. package/src/foundry/common/documents/item.d.mts +6 -5
  64. package/src/foundry/common/documents/journal-entry-category.d.mts +6 -5
  65. package/src/foundry/common/documents/journal-entry-page.d.mts +6 -5
  66. package/src/foundry/common/documents/journal-entry.d.mts +6 -5
  67. package/src/foundry/common/documents/macro.d.mts +6 -5
  68. package/src/foundry/common/documents/measured-template.d.mts +6 -5
  69. package/src/foundry/common/documents/note.d.mts +6 -5
  70. package/src/foundry/common/documents/playlist-sound.d.mts +6 -5
  71. package/src/foundry/common/documents/playlist.d.mts +6 -5
  72. package/src/foundry/common/documents/region-behavior.d.mts +6 -5
  73. package/src/foundry/common/documents/region.d.mts +6 -5
  74. package/src/foundry/common/documents/roll-table.d.mts +6 -5
  75. package/src/foundry/common/documents/scene.d.mts +6 -5
  76. package/src/foundry/common/documents/setting.d.mts +4 -3
  77. package/src/foundry/common/documents/table-result.d.mts +6 -5
  78. package/src/foundry/common/documents/tile.d.mts +6 -5
  79. package/src/foundry/common/documents/token.d.mts +6 -5
  80. package/src/foundry/common/documents/user.d.mts +6 -5
  81. package/src/foundry/common/documents/wall.d.mts +6 -5
  82. package/src/foundry/common/packages/base-world.d.mts +31 -29
  83. package/src/types/augments/pixi.d.mts +4 -0
  84. package/tsconfig.json +2 -5
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.20250705112003",
4
+ "version": "13.346.0-beta.20250705141556",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -48,8 +48,10 @@
48
48
  "eslint:fix": "eslint --cache --fix .",
49
49
  "prettier:fix": "prettier -l -w .",
50
50
  "eslint:report": "eslint --cache --output-file eslint_report.json --format json .",
51
- "test": "vitest --typecheck",
52
- "typecheck": "tsc",
51
+ "test": "vitest --typecheck --run",
52
+ "test:watch": "vitest --typecheck",
53
+ "typecheck": "tsgo",
54
+ "typecheck:all": "tsgo --project tsconfig.all.json",
53
55
  "prepare": "is-ci || husky",
54
56
  "betterer": "betterer",
55
57
  "betterer:update": "betterer --update"
@@ -113,8 +115,8 @@
113
115
  "jquery": "^3.7.1",
114
116
  "mime-types": "^3.0.1",
115
117
  "peggy": "^4.2.0",
116
- "pixi.js": "github:foundry-vtt-types/pixi.js#main",
117
118
  "pixi-basis-ktx2": "^0.0.22",
119
+ "pixi.js": "github:foundry-vtt-types/pixi.js#main",
118
120
  "prosemirror-collab": "^1.3.1",
119
121
  "prosemirror-commands": "^1.7.0",
120
122
  "prosemirror-dropcursor": "^1.8.1",
@@ -168,6 +170,9 @@
168
170
  "typescript-eslint": "^8.31.0",
169
171
  "vitest": "^4.0.0-beta.1"
170
172
  },
173
+ "overrides": {
174
+ "expect-type": "https://pkg.pr.new/mmkal/expect-type@7d6fa42"
175
+ },
171
176
  "peerDependencies": {
172
177
  "typescript": "^5.4"
173
178
  },
@@ -40,7 +40,7 @@ export interface DeprecatedHookConfig {
40
40
  ) => boolean | void;
41
41
 
42
42
  /**
43
- * @deprecated - This hook appears to have been deleted.
43
+ * @deprecated This hook appears to have been deleted.
44
44
  */
45
45
  getSceneNavigationContext: (
46
46
  app: foundry.applications.ui.SceneNavigation,
@@ -31,6 +31,12 @@ declare namespace DocumentSheetV2 {
31
31
  document: ConcreteDocument;
32
32
  }
33
33
 
34
+ type InputOptions<Configuration extends DocumentSheetV2.Configuration<Document.Any>> = DeepPartial<
35
+ Omit<Configuration, "document">
36
+ > & {
37
+ document: Configuration["document"];
38
+ };
39
+
34
40
  /** @internal */
35
41
  interface _Configuration extends ApplicationV2.Configuration {
36
42
  /**
@@ -87,7 +93,7 @@ declare class DocumentSheetV2<
87
93
  Configuration extends DocumentSheetV2.Configuration<Document> = DocumentSheetV2.Configuration<Document>,
88
94
  RenderOptions extends DocumentSheetV2.RenderOptions = DocumentSheetV2.RenderOptions,
89
95
  > extends ApplicationV2<RenderContext, Configuration, RenderOptions> {
90
- constructor(options?: DeepPartial<Configuration>);
96
+ constructor(options?: DocumentSheetV2.InputOptions<Configuration>);
91
97
 
92
98
  static DEFAULT_OPTIONS: DocumentSheetV2.DefaultOptions;
93
99
 
@@ -107,6 +113,7 @@ declare class DocumentSheetV2<
107
113
  */
108
114
  get isEditable(): boolean;
109
115
 
116
+ // TODO(LukeAbby): This needs to be updated to use `DocumentSheetV2.InputOptions` but that breaks subclassing right now
110
117
  protected _initializeApplicationOptions(options: DeepPartial<Configuration>): Configuration;
111
118
 
112
119
  protected override _headerControlsButtons(): Generator<ApplicationV2.HeaderControlsEntry, void, undefined>;
@@ -158,12 +158,12 @@ declare namespace HandlebarsApplicationMixin {
158
158
  }
159
159
 
160
160
  /**
161
- * @deprecated - Merge {@linkcode ApplicationV2.RenderOptions} and {@linkcode HandlebarsApplicationMixin.RenderOptions} individually.
161
+ * @deprecated Merge {@linkcode ApplicationV2.RenderOptions} and {@linkcode HandlebarsApplicationMixin.RenderOptions} individually.
162
162
  */
163
163
  interface ApplicationV2RenderOptions extends RenderOptions, ApplicationV2.RenderOptions {}
164
164
 
165
165
  /**
166
- * @deprecated - Merge {@linkcode DocumentSheetV2.RenderOptions} and {@linkcode HandlebarsApplicationMixin.RenderOptions} individually.
166
+ * @deprecated Merge {@linkcode DocumentSheetV2.RenderOptions} and {@linkcode HandlebarsApplicationMixin.RenderOptions} individually.
167
167
  */
168
168
  interface DocumentSheetV2RenderOptions extends RenderOptions, DocumentSheetV2.RenderOptions {}
169
169
 
@@ -82,7 +82,7 @@ declare namespace AmbientLightConfig {
82
82
  source: foundry.documents.BaseAmbientLight.Source;
83
83
 
84
84
  /**
85
- * @deprecated - Foundry deleted this with no deprecation in v13.
85
+ * @deprecated Foundry deleted this with no deprecation in v13.
86
86
  */
87
87
  fields: foundry.documents.BaseAmbientLight.Schema;
88
88
  colorationTechniques: typeof AdaptiveLightingShader.SHADER_TECHNIQUES;
@@ -91,7 +91,7 @@ declare namespace AmbientLightConfig {
91
91
  lightAnimations: unknown; // TODO: Update after CONFIG updated
92
92
 
93
93
  /**
94
- * @deprecated - Foundry deleted this with no deprecation in v13.
94
+ * @deprecated Foundry deleted this with no deprecation in v13.
95
95
  */
96
96
  tabs: Record<string, ApplicationV2.Tab>;
97
97
  buttons: ApplicationV2.FormFooterButton[];
@@ -24,7 +24,7 @@ declare class RegionBehaviorConfig<
24
24
  Configuration,
25
25
  RenderOptions
26
26
  > {
27
- constructor(options: DeepPartial<Configuration> & { document: Document });
27
+ constructor(options: DocumentSheetV2.InputOptions<Configuration>);
28
28
 
29
29
  static override DEFAULT_OPTIONS: DocumentSheetV2.DefaultOptions;
30
30
  static override PARTS: Record<string, HandlebarsApplicationMixin.HandlebarsTemplatePart>;
@@ -229,15 +229,17 @@ declare namespace DocumentCollection {
229
229
  invalid?: boolean | undefined;
230
230
  }
231
231
 
232
- type GetReturnType<DocumentType extends Document.Type, Options extends GetOptions | undefined> = _ApplyInvalid<
233
- DocumentType,
234
- GetKey<Options, "invalid", false>
235
- >;
232
+ type GetReturnType<DocumentType extends Document.Type, Options extends GetOptions | undefined> =
233
+ | _ApplyInvalid<DocumentType, GetKey<Options, "invalid", false>>
234
+ | _ApplyStrict<GetKey<Options, "strict", undefined>>;
236
235
 
237
236
  /** @internal */
238
237
  type _ApplyInvalid<DocumentType extends Document.Type, Invalid extends boolean | undefined> = Invalid extends true
239
238
  ? Document.InvalidForName<DocumentType> | Document.StoredForName<DocumentType>
240
239
  : Document.StoredForName<DocumentType>;
240
+
241
+ /** @internal */
242
+ type _ApplyStrict<Strict extends boolean | undefined> = Strict extends true ? never : undefined;
241
243
  }
242
244
 
243
245
  export default DocumentCollection;
@@ -512,26 +512,33 @@ declare namespace ActiveEffect {
512
512
  interface DialogCreateOptions extends InexactPartial<Create> {}
513
513
  }
514
514
 
515
+ /**
516
+ * If `Temporary` is true then `ActiveEffect.Implementation`, otherwise `ActiveEffect.Stored`.
517
+ */
518
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
519
+ ? ActiveEffect.Implementation
520
+ : ActiveEffect.Stored;
521
+
515
522
  /**
516
523
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
517
524
  */
518
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
525
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name>, CoreFlags {}
519
526
 
520
527
  namespace Flags {
521
528
  /**
522
529
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
523
530
  */
524
- type Scope = Document.FlagKeyOf<Flags>;
531
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
525
532
 
526
533
  /**
527
534
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
528
535
  */
529
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
536
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
530
537
 
531
538
  /**
532
539
  * Gets the type of a particular flag given a `Scope` and a `Key`.
533
540
  */
534
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
541
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
535
542
  }
536
543
 
537
544
  /**
@@ -647,7 +654,7 @@ declare namespace ActiveEffect {
647
654
  /**
648
655
  * The arguments to construct the document.
649
656
  *
650
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
657
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
651
658
  * now recommended.
652
659
  */
653
660
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -431,26 +431,33 @@ declare namespace ActorDelta {
431
431
  interface DialogCreateOptions extends InexactPartial<Create> {}
432
432
  }
433
433
 
434
+ /**
435
+ * If `Temporary` is true then `ActorDelta.Implementation`, otherwise `ActorDelta.Stored`.
436
+ */
437
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
438
+ ? ActorDelta.Implementation
439
+ : ActorDelta.Stored;
440
+
434
441
  /**
435
442
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
436
443
  */
437
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
444
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
438
445
 
439
446
  namespace Flags {
440
447
  /**
441
448
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
442
449
  */
443
- type Scope = Document.FlagKeyOf<Flags>;
450
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
444
451
 
445
452
  /**
446
453
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
447
454
  */
448
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
455
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
449
456
 
450
457
  /**
451
458
  * Gets the type of a particular flag given a `Scope` and a `Key`.
452
459
  */
453
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
460
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
454
461
  }
455
462
 
456
463
  type PreCreateDescendantDocumentsArgs =
@@ -523,7 +530,7 @@ declare namespace ActorDelta {
523
530
  /**
524
531
  * The arguments to construct the document.
525
532
  *
526
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
533
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
527
534
  * now recommended.
528
535
  * @privateRemarks This is off-template, as ActorDelta throws if not provided a valid TokenDocument
529
536
  * parent in the construction context for any construction, not just `.create`ion
@@ -472,26 +472,33 @@ declare namespace Actor {
472
472
  interface DialogCreateOptions extends InexactPartial<Create> {}
473
473
  }
474
474
 
475
+ /**
476
+ * If `Temporary` is true then `Actor.Implementation`, otherwise `Actor.Stored`.
477
+ */
478
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
479
+ ? Actor.Implementation
480
+ : Actor.Stored;
481
+
475
482
  /**
476
483
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
477
484
  */
478
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
485
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
479
486
 
480
487
  namespace Flags {
481
488
  /**
482
489
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
483
490
  */
484
- type Scope = Document.FlagKeyOf<Flags>;
491
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
485
492
 
486
493
  /**
487
494
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
488
495
  */
489
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
496
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
490
497
 
491
498
  /**
492
499
  * Gets the type of a particular flag given a `Scope` and a `Key`.
493
500
  */
494
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
501
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
495
502
  }
496
503
 
497
504
  type PreCreateDescendantDocumentsArgs =
@@ -633,7 +640,7 @@ declare namespace Actor {
633
640
  /**
634
641
  * The arguments to construct the document.
635
642
  *
636
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
643
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
637
644
  * now recommended.
638
645
  */
639
646
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -389,26 +389,33 @@ declare namespace Adventure {
389
389
  interface DialogCreateOptions extends InexactPartial<Create> {}
390
390
  }
391
391
 
392
+ /**
393
+ * If `Temporary` is true then `Adventure.Implementation`, otherwise `Adventure.Stored`.
394
+ */
395
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
396
+ ? Adventure.Implementation
397
+ : Adventure.Stored;
398
+
392
399
  /**
393
400
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
394
401
  */
395
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
402
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
396
403
 
397
404
  namespace Flags {
398
405
  /**
399
406
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
400
407
  */
401
- type Scope = Document.FlagKeyOf<Flags>;
408
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
402
409
 
403
410
  /**
404
411
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
405
412
  */
406
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
413
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
407
414
 
408
415
  /**
409
416
  * Gets the type of a particular flag given a `Scope` and a `Key`.
410
417
  */
411
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
418
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
412
419
  }
413
420
 
414
421
  interface DropData extends Document.Internal.DropData<Name> {}
@@ -476,7 +483,7 @@ declare namespace Adventure {
476
483
  /**
477
484
  * The arguments to construct the document.
478
485
  *
479
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
486
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
480
487
  * now recommended.
481
488
  */
482
489
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -341,26 +341,33 @@ declare namespace AmbientLightDocument {
341
341
  interface DialogCreateOptions extends InexactPartial<Create> {}
342
342
  }
343
343
 
344
+ /**
345
+ * If `Temporary` is true then `AmbientLightDocument.Implementation`, otherwise `AmbientLightDocument.Stored`.
346
+ */
347
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
348
+ ? AmbientLightDocument.Implementation
349
+ : AmbientLightDocument.Stored;
350
+
344
351
  /**
345
352
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
346
353
  */
347
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
354
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name>, CoreFlags {}
348
355
 
349
356
  namespace Flags {
350
357
  /**
351
358
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
352
359
  */
353
- type Scope = Document.FlagKeyOf<Flags>;
360
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
354
361
 
355
362
  /**
356
363
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
357
364
  */
358
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
365
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
359
366
 
360
367
  /**
361
368
  * Gets the type of a particular flag given a `Scope` and a `Key`.
362
369
  */
363
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
370
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
364
371
  }
365
372
 
366
373
  interface CoreFlags {
@@ -381,7 +388,7 @@ declare namespace AmbientLightDocument {
381
388
  /**
382
389
  * The arguments to construct the document.
383
390
  *
384
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
391
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
385
392
  * now recommended.
386
393
  */
387
394
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -399,26 +399,33 @@ declare namespace AmbientSoundDocument {
399
399
  interface DialogCreateOptions extends InexactPartial<Create> {}
400
400
  }
401
401
 
402
+ /**
403
+ * If `Temporary` is true then `AmbientSoundDocument.Implementation`, otherwise `AmbientSoundDocument.Stored`.
404
+ */
405
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
406
+ ? AmbientSoundDocument.Implementation
407
+ : AmbientSoundDocument.Stored;
408
+
402
409
  /**
403
410
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
404
411
  */
405
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
412
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
406
413
 
407
414
  namespace Flags {
408
415
  /**
409
416
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
410
417
  */
411
- type Scope = Document.FlagKeyOf<Flags>;
418
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
412
419
 
413
420
  /**
414
421
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
415
422
  */
416
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
423
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
417
424
 
418
425
  /**
419
426
  * Gets the type of a particular flag given a `Scope` and a `Key`.
420
427
  */
421
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
428
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
422
429
  }
423
430
 
424
431
  interface DropData extends Document.Internal.DropData<Name> {}
@@ -442,7 +449,7 @@ declare namespace AmbientSoundDocument {
442
449
  /**
443
450
  * The arguments to construct the document.
444
451
  *
445
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
452
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
446
453
  * now recommended.
447
454
  */
448
455
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -477,26 +477,31 @@ declare namespace Card {
477
477
  interface DialogCreateOptions extends InexactPartial<Create> {}
478
478
  }
479
479
 
480
+ /**
481
+ * If `Temporary` is true then `Card.Implementation`, otherwise `Card.Stored`.
482
+ */
483
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary ? Card.Implementation : Card.Stored;
484
+
480
485
  /**
481
486
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
482
487
  */
483
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
488
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
484
489
 
485
490
  namespace Flags {
486
491
  /**
487
492
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
488
493
  */
489
- type Scope = Document.FlagKeyOf<Flags>;
494
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
490
495
 
491
496
  /**
492
497
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
493
498
  */
494
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
499
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
495
500
 
496
501
  /**
497
502
  * Gets the type of a particular flag given a `Scope` and a `Key`.
498
503
  */
499
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
504
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
500
505
  }
501
506
 
502
507
  interface DropData extends Document.Internal.DropData<Name> {}
@@ -543,7 +548,7 @@ declare namespace Card {
543
548
  /**
544
549
  * The arguments to construct the document.
545
550
  *
546
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
551
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
547
552
  * now recommended.
548
553
  */
549
554
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -650,7 +655,7 @@ declare class Card<out SubType extends Card.SubType = Card.SubType> extends Base
650
655
  toMessage<Temporary extends boolean | undefined = undefined>(
651
656
  messageData?: DeepPartial<foundry.documents.BaseChatMessage.CreateData>,
652
657
  options?: ChatMessage.Database.CreateOperation<Temporary>,
653
- ): Promise<Document.TemporaryIf<ChatMessage.Implementation, Temporary> | undefined>;
658
+ ): Promise<ChatMessage.TemporaryIf<Temporary> | undefined>;
654
659
 
655
660
  /*
656
661
  * After this point these are not really overridden methods.
@@ -491,26 +491,33 @@ declare namespace Cards {
491
491
  interface DialogCreateOptions extends InexactPartial<Create> {}
492
492
  }
493
493
 
494
+ /**
495
+ * If `Temporary` is true then `Cards.Implementation`, otherwise `Cards.Stored`.
496
+ */
497
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
498
+ ? Cards.Implementation
499
+ : Cards.Stored;
500
+
494
501
  /**
495
502
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
496
503
  */
497
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
504
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name> {}
498
505
 
499
506
  namespace Flags {
500
507
  /**
501
508
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
502
509
  */
503
- type Scope = Document.FlagKeyOf<Flags>;
510
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
504
511
 
505
512
  /**
506
513
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
507
514
  */
508
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
515
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
509
516
 
510
517
  /**
511
518
  * Gets the type of a particular flag given a `Scope` and a `Key`.
512
519
  */
513
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
520
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
514
521
  }
515
522
 
516
523
  type PreCreateDescendantDocumentsArgs = Document.PreCreateDescendantDocumentsArgs<
@@ -712,7 +719,7 @@ declare namespace Cards {
712
719
  /**
713
720
  * The arguments to construct the document.
714
721
  *
715
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
722
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
716
723
  * now recommended.
717
724
  */
718
725
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -765,7 +772,7 @@ declare class Cards<out SubType extends Cards.SubType = Cards.SubType> extends B
765
772
  static override createDocuments<Temporary extends boolean | undefined = undefined>(
766
773
  data: Array<Cards.Implementation | Cards.CreateData> | undefined,
767
774
  operation?: Document.Database.CreateOperation<Cards.Database.Create<Temporary>>,
768
- ): Promise<Array<Document.TemporaryIf<Cards.Implementation, Temporary>>>;
775
+ ): Promise<Array<Cards.TemporaryIf<Temporary>>>;
769
776
 
770
777
  /**
771
778
  * Deal one or more cards from this Cards document to each of a provided array of Cards destinations.
@@ -467,26 +467,33 @@ declare namespace ChatMessage {
467
467
  interface DialogCreateOptions extends InexactPartial<Create> {}
468
468
  }
469
469
 
470
+ /**
471
+ * If `Temporary` is true then `ChatMessage.Implementation`, otherwise `ChatMessage.Stored`.
472
+ */
473
+ type TemporaryIf<Temporary extends boolean | undefined> = true extends Temporary
474
+ ? ChatMessage.Implementation
475
+ : ChatMessage.Stored;
476
+
470
477
  /**
471
478
  * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
472
479
  */
473
- interface Flags extends Document.ConfiguredFlagsForName<Name> {}
480
+ interface Flags extends Document.Internal.ConfiguredFlagsForName<Name>, CoreFlags {}
474
481
 
475
482
  namespace Flags {
476
483
  /**
477
484
  * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
478
485
  */
479
- type Scope = Document.FlagKeyOf<Flags>;
486
+ type Scope = Document.Internal.FlagKeyOf<Flags>;
480
487
 
481
488
  /**
482
489
  * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
483
490
  */
484
- type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
491
+ type Key<Scope extends Flags.Scope> = Document.Internal.FlagKeyOf<Document.Internal.FlagGetKey<Flags, Scope>>;
485
492
 
486
493
  /**
487
494
  * Gets the type of a particular flag given a `Scope` and a `Key`.
488
495
  */
489
- type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
496
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.Internal.GetFlag<Flags, Scope, Key>;
490
497
  }
491
498
 
492
499
  interface CoreFlags {
@@ -524,17 +531,17 @@ declare namespace ChatMessage {
524
531
  interface GetSpeakerOptions extends NullishProps<_BaseSpeakerOptions> {}
525
532
 
526
533
  /**
527
- * @deprecated - The associated function was made private without deprecation or direct replacement.
534
+ * @deprecated The associated function was made private without deprecation or direct replacement.
528
535
  */
529
536
  interface GetSpeakerFromTokenOptions extends NullishProps<Pick<_BaseSpeakerOptions, "token" | "alias">> {}
530
537
 
531
538
  /**
532
- * @deprecated - The associated function was made private without deprecation or direct replacement.
539
+ * @deprecated The associated function was made private without deprecation or direct replacement.
533
540
  */
534
541
  interface GetSpeakerFromActorOptions extends NullishProps<Pick<_BaseSpeakerOptions, "scene" | "actor" | "alias">> {}
535
542
 
536
543
  /**
537
- *@deprecated - The associated function was made private without deprecation or direct replacement.
544
+ *@deprecated The associated function was made private without deprecation or direct replacement.
538
545
  */
539
546
  interface GetSpeakerFromUserOptions extends NullishProps<Pick<_BaseSpeakerOptions, "scene" | "alias">> {
540
547
  /** The User who is speaking */
@@ -630,7 +637,7 @@ declare namespace ChatMessage {
630
637
  /**
631
638
  * The arguments to construct the document.
632
639
  *
633
- * @deprecated - Writing the signature directly has helped reduce circularities and therefore is
640
+ * @deprecated Writing the signature directly has helped reduce circularities and therefore is
634
641
  * now recommended.
635
642
  */
636
643
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -369,6 +369,8 @@ declare namespace CompendiumCollection {
369
369
  }
370
370
 
371
371
  // TODO: Improve automatic index properties based on document type
372
+ // TODO(LukeAbby): Switch to `Document.StoredSourceForName`.
373
+ // Investigate why the `DeepPartial` too
372
374
  type IndexEntry<Type extends DocumentName> = { _id: string; uuid: string } & DeepPartial<
373
375
  Document.SourceForName<Type>
374
376
  >;