@league-of-foundry-developers/foundry-vtt-types 12.331.3-beta → 12.331.5

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 (559) hide show
  1. package/README.md +17 -18
  2. package/package.json +91 -32
  3. package/src/configuration/configuration.d.mts +316 -0
  4. package/src/configuration/documents.d.mts +295 -0
  5. package/src/configuration/globals.d.mts +357 -0
  6. package/src/configuration/index.d.mts +5 -0
  7. package/src/foundry/client/apps/app.d.mts +129 -122
  8. package/src/foundry/client/apps/av/av-config.d.mts +12 -7
  9. package/src/foundry/client/apps/av/cameras.d.mts +12 -7
  10. package/src/foundry/client/apps/dice/dice-config.d.mts +59 -0
  11. package/src/foundry/client/apps/dice/index.d.mts +1 -0
  12. package/src/foundry/client/apps/form.d.mts +114 -86
  13. package/src/foundry/client/apps/forms/actor.d.mts +21 -11
  14. package/src/foundry/client/apps/forms/adventure-exporter.d.mts +12 -7
  15. package/src/foundry/client/apps/forms/adventure-importer.d.mts +14 -6
  16. package/src/foundry/client/apps/forms/base-sheet.d.mts +16 -8
  17. package/src/foundry/client/apps/forms/card-config.d.mts +16 -8
  18. package/src/foundry/client/apps/forms/cards-config.d.mts +15 -14
  19. package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
  20. package/src/foundry/client/apps/forms/combatant-config.d.mts +3 -3
  21. package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
  22. package/src/foundry/client/apps/forms/effect-config.d.mts +7 -7
  23. package/src/foundry/client/apps/forms/folder-config.d.mts +10 -5
  24. package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
  25. package/src/foundry/client/apps/forms/grid-config.d.mts +12 -13
  26. package/src/foundry/client/apps/forms/image-popout.d.mts +29 -23
  27. package/src/foundry/client/apps/forms/item.d.mts +9 -9
  28. package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +16 -14
  29. package/src/foundry/client/apps/forms/journal-sheet.d.mts +48 -38
  30. package/src/foundry/client/apps/forms/macro-config.d.mts +7 -7
  31. package/src/foundry/client/apps/forms/measure-template.d.mts +10 -12
  32. package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
  33. package/src/foundry/client/apps/forms/playlist-config.d.mts +8 -10
  34. package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +7 -7
  35. package/src/foundry/client/apps/forms/roll-table-config.d.mts +11 -10
  36. package/src/foundry/client/apps/forms/scene-config.d.mts +40 -41
  37. package/src/foundry/client/apps/forms/sheet-config.d.mts +9 -21
  38. package/src/foundry/client/apps/forms/user-config.d.mts +13 -12
  39. package/src/foundry/client/apps/hud/chatbubble.d.mts +18 -6
  40. package/src/foundry/client/apps/hud/container.d.mts +4 -4
  41. package/src/foundry/client/apps/hud/controls.d.mts +126 -81
  42. package/src/foundry/client/apps/hud/hotbar.d.mts +17 -12
  43. package/src/foundry/client/apps/hud/hud.d.mts +5 -5
  44. package/src/foundry/client/apps/hud/menu.d.mts +10 -3
  45. package/src/foundry/client/apps/hud/navigation.d.mts +14 -9
  46. package/src/foundry/client/apps/hud/pause.d.mts +9 -4
  47. package/src/foundry/client/apps/hud/players.d.mts +14 -9
  48. package/src/foundry/client/apps/i18n.d.mts +31 -27
  49. package/src/foundry/client/apps/index.d.mts +1 -0
  50. package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
  51. package/src/foundry/client/apps/placeables/drawing-hud.d.mts +5 -5
  52. package/src/foundry/client/apps/placeables/index.d.mts +0 -2
  53. package/src/foundry/client/apps/placeables/note-config.d.mts +28 -18
  54. package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
  55. package/src/foundry/client/apps/placeables/tile-hud.d.mts +10 -5
  56. package/src/foundry/client/apps/placeables/token-config.d.mts +91 -58
  57. package/src/foundry/client/apps/placeables/token-hud.d.mts +12 -7
  58. package/src/foundry/client/apps/placeables/wall-config.d.mts +21 -17
  59. package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
  60. package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +3 -3
  61. package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +15 -13
  62. package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
  63. package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +3 -2
  64. package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
  65. package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
  66. package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +34 -29
  67. package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +2 -2
  68. package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +13 -10
  69. package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +50 -35
  70. package/src/foundry/client/apps/sidebar/document-directory.d.mts +52 -38
  71. package/src/foundry/client/apps/sidebar/package-configuration.d.mts +4 -4
  72. package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
  73. package/src/foundry/client/apps/sidebar/sidebar.d.mts +9 -4
  74. package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +11 -2
  75. package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +11 -2
  76. package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +39 -27
  77. package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +21 -12
  78. package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +30 -15
  79. package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +11 -2
  80. package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +11 -2
  81. package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +14 -5
  82. package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +30 -22
  83. package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +11 -2
  84. package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +14 -5
  85. package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +23 -5
  86. package/src/foundry/client/apps/templates.d.mts +1 -1
  87. package/src/foundry/client/av/client.d.mts +1 -1
  88. package/src/foundry/client/av/clients/simplepeer.d.mts +11 -1
  89. package/src/foundry/client/av/master.d.mts +2 -2
  90. package/src/foundry/client/av/settings.d.mts +17 -15
  91. package/src/foundry/client/config.d.mts +444 -312
  92. package/src/foundry/client/core/document-index.d.mts +11 -3
  93. package/src/foundry/client/core/hooks.d.mts +2 -4
  94. package/src/foundry/client/core/image.d.mts +14 -13
  95. package/src/foundry/client/core/issues.d.mts +9 -4
  96. package/src/foundry/client/core/keybindings.d.mts +5 -5
  97. package/src/foundry/client/core/nue.d.mts +1 -1
  98. package/src/foundry/client/core/packages.d.mts +400 -62
  99. package/src/foundry/client/core/settings.d.mts +62 -38
  100. package/src/foundry/client/core/socket.d.mts +2 -2
  101. package/src/foundry/client/core/sorting.d.mts +6 -6
  102. package/src/foundry/client/core/time.d.mts +6 -3
  103. package/src/foundry/client/core/tooltip.d.mts +2 -2
  104. package/src/foundry/client/core/tour.d.mts +59 -50
  105. package/src/foundry/client/core/tours.d.mts +1 -1
  106. package/src/foundry/client/core/utils.d.mts +33 -10
  107. package/src/foundry/client/core/video.d.mts +1 -1
  108. package/src/foundry/client/core/workers.d.mts +24 -17
  109. package/src/foundry/client/data/abstract/canvas-document.d.mts +22 -28
  110. package/src/foundry/client/data/abstract/client-document.d.mts +238 -206
  111. package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +24 -40
  112. package/src/foundry/client/data/abstract/document-collection.d.mts +96 -68
  113. package/src/foundry/client/data/abstract/world-collection.d.mts +53 -54
  114. package/src/foundry/client/data/collections/actors.d.mts +30 -28
  115. package/src/foundry/client/data/collections/cards.d.mts +16 -3
  116. package/src/foundry/client/data/collections/combats.d.mts +18 -5
  117. package/src/foundry/client/data/collections/compendium-collection.d.mts +84 -101
  118. package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
  119. package/src/foundry/client/data/collections/compendium-packs.d.mts +5 -5
  120. package/src/foundry/client/data/collections/fog.d.mts +16 -3
  121. package/src/foundry/client/data/collections/folder.d.mts +20 -6
  122. package/src/foundry/client/data/collections/items.d.mts +17 -4
  123. package/src/foundry/client/data/collections/journal.d.mts +22 -7
  124. package/src/foundry/client/data/collections/macros.d.mts +21 -19
  125. package/src/foundry/client/data/collections/messages.d.mts +19 -6
  126. package/src/foundry/client/data/collections/playlists.d.mts +17 -5
  127. package/src/foundry/client/data/collections/scenes.d.mts +24 -27
  128. package/src/foundry/client/data/collections/settings.d.mts +16 -3
  129. package/src/foundry/client/data/collections/tables.d.mts +18 -5
  130. package/src/foundry/client/data/collections/users.d.mts +22 -10
  131. package/src/foundry/client/data/documents/active-effect.d.mts +780 -112
  132. package/src/foundry/client/data/documents/actor-delta.d.mts +705 -31
  133. package/src/foundry/client/data/documents/actor.d.mts +806 -98
  134. package/src/foundry/client/data/documents/adventure.d.mts +522 -59
  135. package/src/foundry/client/data/documents/ambient-light.d.mts +427 -20
  136. package/src/foundry/client/data/documents/ambient-sound.d.mts +478 -14
  137. package/src/foundry/client/data/documents/card.d.mts +598 -44
  138. package/src/foundry/client/data/documents/cards.d.mts +862 -169
  139. package/src/foundry/client/data/documents/chat-message.d.mts +668 -77
  140. package/src/foundry/client/data/documents/combat.d.mts +757 -107
  141. package/src/foundry/client/data/documents/combatant.d.mts +545 -32
  142. package/src/foundry/client/data/documents/drawing.d.mts +545 -14
  143. package/src/foundry/client/data/documents/fog-exploration.d.mts +465 -30
  144. package/src/foundry/client/data/documents/folder.d.mts +567 -51
  145. package/src/foundry/client/data/documents/index.d.mts +2 -0
  146. package/src/foundry/client/data/documents/item.d.mts +691 -24
  147. package/src/foundry/client/data/documents/journal-entry-page.d.mts +654 -55
  148. package/src/foundry/client/data/documents/journal-entry.d.mts +631 -35
  149. package/src/foundry/client/data/documents/macro.d.mts +560 -31
  150. package/src/foundry/client/data/documents/measured-template.d.mts +484 -15
  151. package/src/foundry/client/data/documents/note.d.mts +498 -15
  152. package/src/foundry/client/data/documents/playlist-sound.d.mts +443 -45
  153. package/src/foundry/client/data/documents/playlist.d.mts +710 -99
  154. package/src/foundry/client/data/documents/region-behavior.d.mts +516 -0
  155. package/src/foundry/client/data/documents/region.d.mts +789 -0
  156. package/src/foundry/client/data/documents/scene.d.mts +1216 -159
  157. package/src/foundry/client/data/documents/setting.d.mts +406 -23
  158. package/src/foundry/client/data/documents/table-result.d.mts +488 -14
  159. package/src/foundry/client/data/documents/table.d.mts +667 -78
  160. package/src/foundry/client/data/documents/tile.d.mts +505 -14
  161. package/src/foundry/client/data/documents/token.d.mts +1191 -143
  162. package/src/foundry/client/data/documents/user.d.mts +613 -57
  163. package/src/foundry/client/data/documents/wall.d.mts +555 -14
  164. package/src/foundry/client/game.d.mts +60 -92
  165. package/src/foundry/client/head.d.mts +9 -9
  166. package/src/foundry/client/hooks.d.mts +259 -248
  167. package/src/foundry/client/pixi/board.d.mts +107 -94
  168. package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +97 -25
  169. package/src/foundry/client/pixi/core/containers/cached-container.d.mts +37 -19
  170. package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +7 -10
  171. package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +25 -15
  172. package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +16 -6
  173. package/src/foundry/client/pixi/core/containers/quadtree.d.mts +113 -54
  174. package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +69 -26
  175. package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +20 -2
  176. package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +164 -99
  177. package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +61 -22
  178. package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +120 -53
  179. package/src/foundry/client/pixi/core/interaction/ping.d.mts +62 -31
  180. package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +23 -10
  181. package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +91 -34
  182. package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +69 -30
  183. package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +35 -5
  184. package/src/foundry/client/pixi/core/interaction/targets.d.mts +21 -18
  185. package/src/foundry/client/pixi/core/loader.d.mts +86 -76
  186. package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +42 -17
  187. package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +92 -64
  188. package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +28 -10
  189. package/src/foundry/client/pixi/core/shapes/ray.d.mts +47 -23
  190. package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +170 -75
  191. package/src/foundry/client/pixi/extensions/circle.d.mts +128 -125
  192. package/src/foundry/client/pixi/extensions/graphics.d.mts +3 -1
  193. package/src/foundry/client/pixi/extensions/observable-transform.d.mts +5 -4
  194. package/src/foundry/client/pixi/extensions/polygon.d.mts +154 -134
  195. package/src/foundry/client/pixi/extensions/rectangle.d.mts +242 -259
  196. package/src/foundry/client/pixi/groups/effects.d.mts +75 -24
  197. package/src/foundry/client/pixi/groups/environment.d.mts +68 -19
  198. package/src/foundry/client/pixi/groups/hidden.d.mts +27 -11
  199. package/src/foundry/client/pixi/groups/interface.d.mts +62 -38
  200. package/src/foundry/client/pixi/groups/overlay.d.mts +19 -7
  201. package/src/foundry/client/pixi/groups/primary.d.mts +66 -44
  202. package/src/foundry/client/pixi/groups/rendered.d.mts +19 -7
  203. package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +11 -15
  204. package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +29 -28
  205. package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +306 -272
  206. package/src/foundry/client/pixi/layers/controls/cursor.d.mts +18 -9
  207. package/src/foundry/client/pixi/layers/controls/door.d.mts +32 -11
  208. package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -77
  209. package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
  210. package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +9 -12
  211. package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +9 -10
  212. package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +8 -8
  213. package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +22 -22
  214. package/src/foundry/client/pixi/layers/effects/visibility.d.mts +106 -86
  215. package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +14 -5
  216. package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
  217. package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +137 -65
  218. package/src/foundry/client/pixi/layers/grid/highlight.d.mts +14 -4
  219. package/src/foundry/client/pixi/layers/grid/layer.d.mts +92 -92
  220. package/src/foundry/client/pixi/layers/grid/mesh.d.mts +37 -16
  221. package/src/foundry/client/pixi/layers/masks/depth.d.mts +12 -7
  222. package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +19 -12
  223. package/src/foundry/client/pixi/layers/masks/vision.d.mts +104 -18
  224. package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +16 -15
  225. package/src/foundry/client/pixi/layers/placeables/index.d.mts +1 -0
  226. package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +12 -14
  227. package/src/foundry/client/pixi/layers/placeables/notes.d.mts +49 -32
  228. package/src/foundry/client/pixi/layers/placeables/regions.d.mts +113 -0
  229. package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -67
  230. package/src/foundry/client/pixi/layers/placeables/templates.d.mts +11 -15
  231. package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +30 -21
  232. package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +66 -52
  233. package/src/foundry/client/pixi/layers/placeables/walls.d.mts +54 -57
  234. package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +62 -27
  235. package/src/foundry/client/pixi/perception/detection-mode.d.mts +121 -47
  236. package/src/foundry/client/pixi/perception/fog.d.mts +38 -15
  237. package/src/foundry/client/pixi/perception/perception-manager.d.mts +136 -136
  238. package/src/foundry/client/pixi/perception/vision-mode.d.mts +91 -64
  239. package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +44 -16
  240. package/src/foundry/client/pixi/placeable.d.mts +239 -137
  241. package/src/foundry/client/pixi/placeables/drawing.d.mts +255 -133
  242. package/src/foundry/client/pixi/placeables/index.d.mts +1 -0
  243. package/src/foundry/client/pixi/placeables/light.d.mts +193 -64
  244. package/src/foundry/client/pixi/placeables/note.d.mts +145 -54
  245. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +30 -8
  246. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +41 -11
  247. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +59 -18
  248. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +120 -37
  249. package/src/foundry/client/pixi/placeables/region.d.mts +280 -0
  250. package/src/foundry/client/pixi/placeables/sound.d.mts +205 -66
  251. package/src/foundry/client/pixi/placeables/template.d.mts +181 -100
  252. package/src/foundry/client/pixi/placeables/tile.d.mts +206 -140
  253. package/src/foundry/client/pixi/placeables/token.d.mts +916 -449
  254. package/src/foundry/client/pixi/placeables/wall.d.mts +249 -129
  255. package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +72 -33
  256. package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +10 -9
  257. package/src/foundry/client/pixi/webgl/helpers/{framebugger-snapshot.d.mts → framebuffer-snapshot.d.mts} +10 -9
  258. package/src/foundry/client/pixi/webgl/helpers/index.d.mts +1 -1
  259. package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +38 -23
  260. package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +82 -53
  261. package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +12 -12
  262. package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +45 -28
  263. package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +12 -11
  264. package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +12 -10
  265. package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +22 -20
  266. package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +36 -32
  267. package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +10 -9
  268. package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +12 -11
  269. package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +10 -9
  270. package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +12 -11
  271. package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +67 -60
  272. package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +24 -17
  273. package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +13 -10
  274. package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +10 -9
  275. package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +11 -10
  276. package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +20 -14
  277. package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +12 -11
  278. package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +10 -9
  279. package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +33 -33
  280. package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +10 -9
  281. package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +10 -9
  282. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +19 -17
  283. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +10 -9
  284. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +10 -9
  285. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +10 -9
  286. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +10 -9
  287. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +19 -17
  288. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +19 -17
  289. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +10 -9
  290. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +10 -8
  291. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +19 -17
  292. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +10 -9
  293. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +10 -9
  294. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +10 -9
  295. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +19 -17
  296. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +10 -9
  297. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +10 -9
  298. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +10 -9
  299. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +19 -17
  300. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +20 -17
  301. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +10 -9
  302. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +19 -17
  303. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +10 -9
  304. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +19 -17
  305. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +19 -17
  306. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +19 -17
  307. package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +10 -9
  308. package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +71 -29
  309. package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +54 -10
  310. package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +69 -9
  311. package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +24 -25
  312. package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +10 -9
  313. package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +38 -29
  314. package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +21 -17
  315. package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +10 -9
  316. package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +20 -18
  317. package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +11 -2
  318. package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +28 -2
  319. package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +10 -9
  320. package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +11 -9
  321. package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +10 -9
  322. package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +10 -9
  323. package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +19 -17
  324. package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +10 -9
  325. package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +40 -36
  326. package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +27 -33
  327. package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +17 -16
  328. package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +19 -18
  329. package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +15 -14
  330. package/src/foundry/client/pixi/workers/texture-worker.d.mts +33 -53
  331. package/src/foundry/client/tours/setup-tour.d.mts +15 -10
  332. package/src/foundry/client/ui/context.d.mts +48 -40
  333. package/src/foundry/client/ui/dialog.d.mts +137 -126
  334. package/src/foundry/client/ui/drag.d.mts +1 -1
  335. package/src/foundry/client/ui/dragdrop.d.mts +34 -28
  336. package/src/foundry/client/ui/editor.d.mts +29 -21
  337. package/src/foundry/client/ui/filepicker.d.mts +43 -38
  338. package/src/foundry/client/ui/filter.d.mts +62 -50
  339. package/src/foundry/client/ui/forms.d.mts +22 -22
  340. package/src/foundry/client/ui/notifications.d.mts +10 -3
  341. package/src/foundry/client/ui/prosemirror.d.mts +15 -7
  342. package/src/foundry/client/ui/secrets.d.mts +42 -27
  343. package/src/foundry/client/ui/tabs.d.mts +40 -33
  344. package/src/foundry/client-esm/applications/_module.d.mts +3 -3
  345. package/src/foundry/client-esm/applications/_types.d.mts +0 -2
  346. package/src/foundry/client-esm/applications/api/_module.d.mts +2 -2
  347. package/src/foundry/client-esm/applications/api/application.d.mts +28 -19
  348. package/src/foundry/client-esm/applications/api/dialog.d.mts +20 -22
  349. package/src/foundry/client-esm/applications/api/document-sheet.d.mts +26 -12
  350. package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +142 -126
  351. package/src/foundry/client-esm/applications/apps/_module.d.mts +2 -2
  352. package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +10 -10
  353. package/src/foundry/client-esm/applications/apps/permission-config.d.mts +3 -3
  354. package/src/foundry/client-esm/applications/dice/_module.d.mts +2 -2
  355. package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +14 -2
  356. package/src/foundry/client-esm/applications/elements/_module.d.mts +2 -2
  357. package/src/foundry/client-esm/applications/elements/document-tags.d.mts +2 -0
  358. package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
  359. package/src/foundry/client-esm/applications/elements/multi-select.d.mts +15 -5
  360. package/src/foundry/client-esm/applications/elements/string-tags.d.mts +1 -1
  361. package/src/foundry/client-esm/applications/forms/fields.d.mts +1 -1
  362. package/src/foundry/client-esm/applications/sheets/_module.d.mts +2 -2
  363. package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +3 -3
  364. package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +10 -8
  365. package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +9 -7
  366. package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +3 -3
  367. package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +30 -5
  368. package/src/foundry/client-esm/applications/sheets/region-config.d.mts +36 -5
  369. package/src/foundry/client-esm/applications/sheets/user-config.d.mts +8 -7
  370. package/src/foundry/client-esm/applications/ui/_module.d.mts +2 -2
  371. package/src/foundry/client-esm/applications/ui/region-legend.d.mts +45 -3
  372. package/src/foundry/client-esm/audio/_module.d.mts +2 -3
  373. package/src/foundry/client-esm/audio/_types.d.mts +2 -0
  374. package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
  375. package/src/foundry/client-esm/audio/cache.d.mts +31 -20
  376. package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
  377. package/src/foundry/client-esm/audio/helper.d.mts +124 -80
  378. package/src/foundry/client-esm/audio/sound.d.mts +230 -126
  379. package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
  380. package/src/foundry/client-esm/canvas/_module.d.mts +2 -2
  381. package/src/foundry/client-esm/canvas/edges/_module.d.mts +2 -2
  382. package/src/foundry/client-esm/canvas/edges/collision.d.mts +69 -18
  383. package/src/foundry/client-esm/canvas/edges/edge.d.mts +110 -41
  384. package/src/foundry/client-esm/canvas/edges/edges.d.mts +10 -0
  385. package/src/foundry/client-esm/canvas/edges/vertex.d.mts +56 -26
  386. package/src/foundry/client-esm/canvas/regions/_module.d.mts +6 -11
  387. package/src/foundry/client-esm/canvas/regions/geometry.d.mts +38 -0
  388. package/src/foundry/client-esm/canvas/regions/mesh.d.mts +72 -0
  389. package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +130 -0
  390. package/src/foundry/client-esm/canvas/regions/shape.d.mts +129 -0
  391. package/src/foundry/client-esm/canvas/scene-manager.d.mts +13 -3
  392. package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
  393. package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
  394. package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +121 -23
  395. package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
  396. package/src/foundry/client-esm/canvas/sources/_module.d.mts +2 -2
  397. package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +84 -40
  398. package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +103 -39
  399. package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +89 -15
  400. package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +71 -27
  401. package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +49 -20
  402. package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +57 -16
  403. package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +31 -4
  404. package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +45 -12
  405. package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +98 -52
  406. package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +180 -69
  407. package/src/foundry/client-esm/canvas/tokens/_module.d.mts +2 -3
  408. package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +175 -2
  409. package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +142 -2
  410. package/src/foundry/client-esm/canvas/tokens/ring.d.mts +284 -2
  411. package/src/foundry/client-esm/client.d.mts +47 -54
  412. package/src/foundry/client-esm/data/_module.d.mts +2 -2
  413. package/src/foundry/client-esm/data/client-backend.d.mts +22 -23
  414. package/src/foundry/client-esm/data/region-behaviors/_module.d.mts +11 -14
  415. package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +56 -0
  416. package/src/foundry/client-esm/data/region-behaviors/base.d.mts +59 -0
  417. package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +64 -0
  418. package/src/foundry/client-esm/data/region-behaviors/execute-macro.d.mts +27 -0
  419. package/src/foundry/client-esm/data/region-behaviors/execute-script.d.mts +23 -0
  420. package/src/foundry/client-esm/data/region-behaviors/pause-game.d.mts +23 -0
  421. package/src/foundry/client-esm/data/region-behaviors/suppress-weather.d.mts +17 -0
  422. package/src/foundry/client-esm/data/region-behaviors/teleport-token.d.mts +32 -0
  423. package/src/foundry/client-esm/data/region-behaviors/toggle-behavior.d.mts +31 -0
  424. package/src/foundry/client-esm/dice/_module.d.mts +2 -3
  425. package/src/foundry/client-esm/dice/parser.d.mts +11 -25
  426. package/src/foundry/client-esm/dice/roll.d.mts +112 -89
  427. package/src/foundry/client-esm/dice/terms/_module.d.mts +2 -3
  428. package/src/foundry/client-esm/dice/terms/coin.d.mts +8 -5
  429. package/src/foundry/client-esm/dice/terms/dice.d.mts +93 -63
  430. package/src/foundry/client-esm/dice/terms/die.d.mts +11 -4
  431. package/src/foundry/client-esm/dice/terms/fate.d.mts +9 -2
  432. package/src/foundry/client-esm/dice/terms/function.d.mts +18 -18
  433. package/src/foundry/client-esm/dice/terms/numeric.d.mts +3 -5
  434. package/src/foundry/client-esm/dice/terms/operator.d.mts +2 -2
  435. package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +9 -10
  436. package/src/foundry/client-esm/dice/terms/pool.d.mts +25 -31
  437. package/src/foundry/client-esm/dice/terms/string.d.mts +4 -4
  438. package/src/foundry/client-esm/dice/terms/term.d.mts +18 -4
  439. package/src/foundry/client-esm/dice/twister.d.mts +3 -3
  440. package/src/foundry/client-esm/helpers/_module.d.mts +2 -2
  441. package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
  442. package/src/foundry/client-esm/helpers/compendium-art.d.mts +56 -4
  443. package/src/foundry/common/abstract/_types.d.mts +60 -54
  444. package/src/foundry/common/abstract/backend.d.mts +51 -45
  445. package/src/foundry/common/abstract/data.d.mts +265 -236
  446. package/src/foundry/common/abstract/document.d.mts +1449 -464
  447. package/src/foundry/common/abstract/embedded-collection-delta.d.mts +1 -1
  448. package/src/foundry/common/abstract/embedded-collection.d.mts +37 -7
  449. package/src/foundry/common/abstract/module.d.mts +3 -2
  450. package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
  451. package/src/foundry/common/abstract/socket.d.mts +1 -1
  452. package/src/foundry/common/abstract/type-data.d.mts +61 -55
  453. package/src/foundry/common/config.d.mts +11 -3
  454. package/src/foundry/common/constants.d.mts +261 -231
  455. package/src/foundry/common/data/data.d.mts +238 -102
  456. package/src/foundry/common/data/fields.d.mts +1334 -874
  457. package/src/foundry/common/data/module.d.mts +2 -2
  458. package/src/foundry/common/data/validation-failure.d.mts +12 -9
  459. package/src/foundry/common/documents/_module.d.mts +4 -2
  460. package/src/foundry/common/documents/_types.d.mts +22 -56
  461. package/src/foundry/common/documents/active-effect.d.mts +358 -194
  462. package/src/foundry/common/documents/actor-delta.d.mts +403 -73
  463. package/src/foundry/common/documents/actor.d.mts +359 -117
  464. package/src/foundry/common/documents/adventure.d.mts +312 -142
  465. package/src/foundry/common/documents/ambient-light.d.mts +296 -75
  466. package/src/foundry/common/documents/ambient-sound.d.mts +296 -109
  467. package/src/foundry/common/documents/card.d.mts +321 -187
  468. package/src/foundry/common/documents/cards.d.mts +353 -125
  469. package/src/foundry/common/documents/chat-message.d.mts +338 -167
  470. package/src/foundry/common/documents/combat.d.mts +358 -94
  471. package/src/foundry/common/documents/combatant.d.mts +323 -92
  472. package/src/foundry/common/documents/drawing.d.mts +327 -206
  473. package/src/foundry/common/documents/fog-exploration.d.mts +303 -69
  474. package/src/foundry/common/documents/folder.d.mts +307 -82
  475. package/src/foundry/common/documents/item.d.mts +377 -100
  476. package/src/foundry/common/documents/journal-entry-page.d.mts +327 -187
  477. package/src/foundry/common/documents/journal-entry.d.mts +345 -68
  478. package/src/foundry/common/documents/macro.d.mts +325 -139
  479. package/src/foundry/common/documents/measured-template.d.mts +328 -138
  480. package/src/foundry/common/documents/note.d.mts +312 -151
  481. package/src/foundry/common/documents/playlist-sound.d.mts +309 -102
  482. package/src/foundry/common/documents/playlist.d.mts +341 -131
  483. package/src/foundry/common/documents/region-behavior.d.mts +360 -0
  484. package/src/foundry/common/documents/region.d.mts +355 -0
  485. package/src/foundry/common/documents/roll-table.d.mts +320 -102
  486. package/src/foundry/common/documents/scene.d.mts +437 -350
  487. package/src/foundry/common/documents/setting.d.mts +285 -54
  488. package/src/foundry/common/documents/table-result.d.mts +326 -103
  489. package/src/foundry/common/documents/tile.d.mts +337 -172
  490. package/src/foundry/common/documents/token.d.mts +396 -447
  491. package/src/foundry/common/documents/user.d.mts +296 -173
  492. package/src/foundry/common/documents/wall.d.mts +303 -156
  493. package/src/foundry/common/grid/_module.d.mts +3 -3
  494. package/src/foundry/common/grid/base.d.mts +66 -49
  495. package/src/foundry/common/grid/gridless.d.mts +2 -2
  496. package/src/foundry/common/grid/hexagonal.d.mts +35 -28
  497. package/src/foundry/common/grid/square.d.mts +3 -3
  498. package/src/foundry/common/packages/base-module.d.mts +6 -24
  499. package/src/foundry/common/packages/base-package.d.mts +56 -31
  500. package/src/foundry/common/packages/base-system.d.mts +45 -63
  501. package/src/foundry/common/packages/base-world.d.mts +15 -61
  502. package/src/foundry/common/packages/module.d.mts +7 -7
  503. package/src/foundry/common/packages/sub-types.d.mts +4 -6
  504. package/src/foundry/common/primitives/array.d.mts +4 -4
  505. package/src/foundry/common/primitives/math.d.mts +7 -1
  506. package/src/foundry/common/primitives/number.d.mts +2 -2
  507. package/src/foundry/common/primitives/set.d.mts +17 -14
  508. package/src/foundry/common/primitives/string.d.mts +1 -1
  509. package/src/foundry/common/prosemirror/_module.d.mts +15 -15
  510. package/src/foundry/common/prosemirror/dirty-plugin.d.mts +1 -1
  511. package/src/foundry/common/prosemirror/dom-parser.d.mts +2 -1
  512. package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
  513. package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +2 -2
  514. package/src/foundry/common/prosemirror/image-plugin.d.mts +1 -1
  515. package/src/foundry/common/prosemirror/menu.d.mts +3 -3
  516. package/src/foundry/common/prosemirror/paste-transformer.d.mts +1 -1
  517. package/src/foundry/common/prosemirror/plugin.d.mts +2 -2
  518. package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
  519. package/src/foundry/common/prosemirror/schema/lists.d.mts +2 -0
  520. package/src/foundry/common/prosemirror/util.d.mts +1 -1
  521. package/src/foundry/common/types.d.mts +3 -3
  522. package/src/foundry/common/utils/bitmask.d.mts +23 -11
  523. package/src/foundry/common/utils/collection.d.mts +61 -38
  524. package/src/foundry/common/utils/color.d.mts +20 -2
  525. package/src/foundry/common/utils/event-emitter.d.mts +32 -17
  526. package/src/foundry/common/utils/helpers.d.mts +36 -26
  527. package/src/foundry/common/utils/http.d.mts +2 -2
  528. package/src/foundry/common/utils/module.d.mts +2 -2
  529. package/src/foundry/common/utils/string-tree.d.mts +45 -39
  530. package/src/foundry/common/utils/word-tree.d.mts +10 -23
  531. package/src/foundry/index.d.mts +0 -1
  532. package/src/foundry/{clipper → public/scripts/clipper}/clipper.d.mts +58 -16
  533. package/src/foundry/public/scripts/index.d.mts +1 -0
  534. package/src/foundry/public/scripts/workers/image-compressor.d.mts +23 -0
  535. package/src/foundry/public/scripts/workers/index.d.mts +1 -0
  536. package/{index-lenient.d.mts → src/index-lenient.d.mts} +2 -0
  537. package/src/index.d.mts +6 -0
  538. package/src/tsconfig.json +15 -0
  539. package/src/types/augments/particles.d.mts +29 -0
  540. package/src/types/augments/pixi.d.mts +1024 -21
  541. package/src/types/augments/smooth.d.mts +31 -0
  542. package/src/types/augments/tinyMCE.d.mts +1 -1
  543. package/src/types/config.d.mts +18 -313
  544. package/src/types/documentConfiguration.d.mts +286 -542
  545. package/src/types/index.d.mts +1 -1
  546. package/src/types/lib.d.mts +12 -0
  547. package/src/types/workers/image-compressor.d.mts +176 -0
  548. package/src/utils/index.d.mts +1279 -0
  549. package/tsconfig.json +29 -0
  550. package/tsconfig.main.json +8 -0
  551. package/tsconfig.miscellaneous.json +16 -0
  552. package/index.d.mts +0 -5
  553. package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
  554. package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -43
  555. package/src/foundry/common/documents/module.d.mts +0 -35
  556. package/src/foundry/common/primitives/regex.d.mts +0 -12
  557. package/src/types/helperTypes.d.mts +0 -583
  558. package/src/types/utils.d.mts +0 -539
  559. /package/src/foundry/{clipper → public/scripts/clipper}/index.d.mts +0 -0
@@ -1,20 +1,22 @@
1
1
  import type {
2
2
  RemoveIndexSignatures,
3
3
  SimpleMerge,
4
- ValueOf,
5
4
  AnyObject,
6
5
  EmptyObject,
7
6
  NullishProps,
8
7
  InexactPartial,
9
- AnyConstructor,
10
- } from "../../../types/utils.d.mts";
8
+ FixedInstanceType,
9
+ Identity,
10
+ PrettifyType,
11
+ InterfaceToObject,
12
+ AnyArray,
13
+ } from "#utils";
11
14
  import type { DataModel } from "../abstract/data.mts";
12
15
  import type Document from "../abstract/document.mts";
13
16
  import type { EmbeddedCollection, EmbeddedCollectionDelta, TypeDataModel } from "../abstract/module.d.mts";
14
17
  import type { DOCUMENT_OWNERSHIP_LEVELS } from "../constants.d.mts";
15
18
  import type { CONST } from "../../client-esm/client.d.mts";
16
19
  import type { DataModelValidationFailure } from "./validation-failure.mts";
17
- import type { EffectChangeData } from "../documents/_types.d.mts";
18
20
  import type {
19
21
  FormGroupConfig,
20
22
  FormInputConfig,
@@ -23,100 +25,8 @@ import type {
23
25
  SelectInputConfig,
24
26
  TextAreaInputConfig,
25
27
  } from "../../client-esm/applications/forms/fields.d.mts";
26
- import type { ToMethod } from "../../../types/helperTypes.d.mts";
27
28
 
28
- declare global {
29
- /**
30
- * @typeParam BaseAssignmentType - the base assignment type for a DataField, without null or undefined
31
- */
32
- interface DataFieldOptions<BaseAssignmentType> {
33
- /**
34
- * Is this field required to be populated?
35
- * @defaultValue `false`
36
- */
37
- required?: boolean | undefined;
38
-
39
- /**
40
- * Can this field have null values?
41
- * @defaultValue `false`
42
- */
43
- nullable?: boolean | undefined;
44
-
45
- /**
46
- * Can this field only be modified by a gamemaster or assistant gamemaster?
47
- * @defaultValue `false`
48
- */
49
- gmOnly?: boolean | undefined;
50
-
51
- /** The initial value of a field, or a function which assigns that initial value. */
52
- initial?:
53
- | DataFieldOptions.InitialType<
54
- DataFieldOptions.InitialReturnType<BaseAssignmentType, this["nullable"], this["required"]>
55
- >
56
- | undefined;
57
-
58
- /** A data validation function which accepts one argument with the current value. */
59
- validate?: DataField.Validator<BaseAssignmentType> | undefined;
60
-
61
- /** A localizable label displayed on forms which render this field. */
62
- label?: string | undefined;
63
-
64
- /** Localizable help text displayed on forms which render this field. */
65
- hint?: string | undefined;
66
-
67
- /**
68
- * A custom validation error string. When displayed will be prepended with the
69
- * document name, field name, and candidate value. This error string is only
70
- * used when the return type of the validate function is a boolean. If an Error
71
- * is thrown in the validate function, the string message of that Error is used.
72
- */
73
- validationError?: string | undefined;
74
- }
75
-
76
- namespace DataFieldOptions {
77
- /** Any DataFieldOptions. */
78
- // Note(LukeAbby): This `& object` is intentional. Its purpose is to allow options like `{ integer: true }` to be assigned.
79
- // This is an issue because `{ integer: true }` does not extend `{ required?: boolean }` because they have properties in common.
80
- // Even though `{ integer: true, required: undefined }` would extend `{ required?: boolean }` following the regular rules of surplus properties being allowed.
81
- // `object` was chosen over `AnyObject` so that people may pass in interfa
82
- type Any = DataFieldOptions<any> & object;
83
-
84
- /**
85
- * A helper type for the {@link DataFieldOptions.initial} option.
86
- * @typeParam ReturnType - the return type of the option
87
- */
88
- type InitialType<ReturnType> = ReturnType | ((initialData: unknown) => ReturnType);
89
-
90
- /**
91
- * The decorated return type for the {@link DataFieldOptions.initial} option.
92
- * @typeParam BaseAssignmentType - the base assignment type for a DataField
93
- * @typeParam NullableOption - the value of the nullable option
94
- * @typeParam RequiredOption - the value of the required option
95
- */
96
- type InitialReturnType<BaseAssignmentType, NullableOption, RequiredOption> =
97
- | Exclude<BaseAssignmentType, null | undefined>
98
- | (NullableOption extends true ? null : never)
99
- | (RequiredOption extends true ? never : undefined);
100
- }
101
-
102
- interface DataFieldValidationOptions {
103
- /** Whether this is a partial schema validation, or a complete one. */
104
- partial?: boolean;
105
-
106
- /** Whether to allow replacing invalid values with valid fallbacks. */
107
- fallback?: boolean;
108
-
109
- /** The full source object being evaluated. */
110
- source?: AnyObject;
111
-
112
- /**
113
- * If true, invalid embedded documents will emit a warning and be placed in
114
- * the invalidDocuments collection rather than causing the parent to be
115
- * considered invalid.
116
- */
117
- dropInvalidEmbedded?: boolean;
118
- }
119
- }
29
+ export type DataSchema = Record<string, DataField.Any>;
120
30
 
121
31
  /**
122
32
  * An abstract class that defines the base pattern for a data field within a data schema.
@@ -126,24 +36,35 @@ declare global {
126
36
  * @typeParam PersistedType - the type of the persisted values of the DataField
127
37
  * @remarks
128
38
  * Defaults:
129
- * AssignmentType: `unknown | null | undefined`
130
- * InitializedType: `unknown | undefined`
131
- * PersistedType: `unknown | undefined`
132
- * InitialValue: `undefined`
39
+ * - AssignmentType: `unknown | null | undefined`
40
+ * - InitializedType: `unknown | undefined`
41
+ * - PersistedType: `unknown | undefined`
42
+ * - InitialValue: `undefined`
133
43
  */
134
44
  declare abstract class DataField<
135
- const Options extends DataFieldOptions.Any = DataField.DefaultOptions,
45
+ const Options extends DataField.Options.Any = DataField.DefaultOptions,
136
46
  const AssignmentType = DataField.AssignmentType<Options>,
137
47
  const InitializedType = DataField.InitializedType<Options>,
138
- const PersistedType extends unknown | null | undefined = InitializedType,
48
+ const PersistedType = InitializedType,
139
49
  > {
140
50
  // Prevent from being bivariant.
141
51
  #assignmentType: AssignmentType;
142
52
 
143
53
  /**
144
54
  * @param options - Options which configure the behavior of the field
55
+ * @param context - Additional context which describes the field
145
56
  */
146
- constructor(options?: Options, context?: DataField.Context);
57
+ // options: not null (unchecked `in` operation), context: not null (destructured)
58
+ constructor(options?: Options, context?: DataField.ConstructionContext);
59
+
60
+ /** @internal */
61
+ " __fvtt_types_internal_source_data": PersistedType;
62
+
63
+ /** @internal */
64
+ " __fvtt_types_internal_assignment_data": AssignmentType;
65
+
66
+ /** @internal */
67
+ " __fvtt_types_internal_initialized_data": InitializedType;
147
68
 
148
69
  /** The initially provided options which configure the data field */
149
70
  options: Options;
@@ -170,7 +91,7 @@ declare abstract class DataField<
170
91
  * The initial value of a field, or a function which assigns that initial value.
171
92
  * @defaultValue `undefined`
172
93
  */
173
- initial: DataFieldOptions.InitialType<InitializedType>;
94
+ initial: DataField.Options.InitialType<InitializedType>;
174
95
 
175
96
  /**
176
97
  * Should the prepared value of the field be read-only, preventing it from being
@@ -205,14 +126,14 @@ declare abstract class DataField<
205
126
  *
206
127
  * The field name of this DataField instance.
207
128
  * This is assigned by SchemaField#initialize.
208
- * @internal
129
+ * @remarks Foundry marked `@internal`
209
130
  */
210
131
  name: string | undefined;
211
132
 
212
133
  /**
213
134
  * A reference to the parent schema to which this DataField belongs.
214
135
  * This is assigned by SchemaField#initialize.
215
- * @internal
136
+ * @remarks Foundry marked `@internal`
216
137
  */
217
138
  parent: DataField.Any | undefined;
218
139
 
@@ -234,10 +155,11 @@ declare abstract class DataField<
234
155
  * Default parameters for this field type
235
156
  * @remarks This is not entirely type-safe, overrides should specify a more concrete return type.
236
157
  */
237
- protected static get _defaults(): DataFieldOptions.Any;
158
+ protected static get _defaults(): DataField.Options.Any;
238
159
 
239
160
  /**
240
161
  * A dot-separated string representation of the field path within the parent schema.
162
+ * @remarks Returns `""` if both `this.parent?.fieldPath` and `this.name` are falsey
241
163
  */
242
164
  get fieldPath(): string;
243
165
 
@@ -245,13 +167,14 @@ declare abstract class DataField<
245
167
  * Apply a function to this DataField which propagates through recursively to any contained data schema.
246
168
  * @param fn - The function to apply
247
169
  * @param value - The current value of this field
248
- * @param options - Additional options passed to the applied function
249
- * (default `{}`)
170
+ * @param options - Additional options passed to the applied function (default `{}`)
250
171
  * @returns The results object
251
172
  */
252
- apply<Value, Options, Return>(
253
- fn: keyof this | ((this: this, value: Value, options: Options) => Return),
254
- value: Value,
173
+ // TODO: Determine `value` based upon the field metadata in fields-v2 (while allowing subclasses to narrow allowed values)
174
+ // options: not null (could be forwarded somewhere destructured, parameter default only)
175
+ apply<Options, Return>(
176
+ fn: keyof this | ((this: this, value: unknown, options: Options) => Return),
177
+ value?: unknown,
255
178
  options?: Options,
256
179
  ): Return;
257
180
 
@@ -263,6 +186,7 @@ declare abstract class DataField<
263
186
  * @param options - Additional options for how the field is cleaned
264
187
  * @returns The cast value
265
188
  */
189
+ // options: not null (parameter default only, property access)
266
190
  clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
267
191
 
268
192
  /**
@@ -270,8 +194,9 @@ declare abstract class DataField<
270
194
  * @param value - The appropriately coerced value.
271
195
  * @param options - Additional options for how the field is cleaned.
272
196
  * @returns The cleaned value.
197
+ * @remarks Simply returns `value` in `DataField`. `options` is unused in `DataField`
273
198
  */
274
- protected _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
199
+ protected _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
275
200
 
276
201
  /**
277
202
  * Cast a non-default value to ensure it is the correct type for the field
@@ -285,8 +210,12 @@ declare abstract class DataField<
285
210
  * @param data - The source data object for which an initial value is required
286
211
  * @returns A valid initial value
287
212
  * @throws An error if there is no valid initial value defined
213
+ * @remarks The `@throws` is Foundry's, and is wrong, as all fields will at a minimum inherit `initial: undefined` from DataField.
214
+ *
215
+ * `data` is unused if the field's `initial` is not a function.
288
216
  */
289
- getInitialValue(data: DataField.CleanOptions["source"]): InitializedType;
217
+ // TODO: the @throws is omitted in v13, clean up remarks
218
+ getInitialValue(data?: unknown): InitializedType;
290
219
 
291
220
  /**
292
221
  * Validate a candidate input for this field, ensuring it meets the field requirements.
@@ -298,10 +227,8 @@ declare abstract class DataField<
298
227
  * (default: `{}`)
299
228
  * @returns Returns a ModelValidationError if a validation failure occurred
300
229
  */
301
- validate(
302
- value: AssignmentType,
303
- options?: DataField.ValidationOptions<DataField.Any>,
304
- ): DataModelValidationFailure | undefined;
230
+ // options: not null (parameter default only, property access)
231
+ validate(value: AssignmentType, options?: DataField.ValidateOptions<this>): DataModelValidationFailure | void;
305
232
 
306
233
  /**
307
234
  * Special validation rules which supersede regular field validation.
@@ -322,9 +249,10 @@ declare abstract class DataField<
322
249
  * otherwise void.
323
250
  * @throws May throw a specific error if the value is not valid
324
251
  */
252
+ // options: not null (parameter default only, property access in subclasses)
325
253
  protected _validateType(
326
254
  value: InitializedType,
327
- options?: DataField.ValidationOptions<DataField.Any>,
255
+ options?: DataField.ValidateOptions<this>,
328
256
  ): boolean | DataModelValidationFailure | void;
329
257
 
330
258
  /**
@@ -333,9 +261,17 @@ declare abstract class DataField<
333
261
  * @param data - Candidate data for joint model validation
334
262
  * @param options - Options which modify joint model validation
335
263
  * @throws An error if joint model validation fails
336
- * @internal
264
+ * @remarks Foundry marked `@internal`
265
+ *
266
+ * The only place core checks the `options` for any property is in {@link TypeDataField._validateModel | `TypeDataField#_validateModel`},
267
+ * where it checks `options.source?.type`
268
+ *
269
+ * {@link SchemaField._validateModel | `SchemaField._validateModel`} enforces `source`'s existence for subsidiary calls
270
+ *
271
+ * The only place core *calls* this at a top level, it does not pass anything for `options`, relying on SchemaField above
272
+ * to make TypeDataField work
337
273
  */
338
- protected _validateModel(data: AnyObject, options?: AnyObject): void; // TODO: Type further.
274
+ protected _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions | null): void; // TODO: Type further.
339
275
 
340
276
  /**
341
277
  * Initialize the original source data into a mutable copy for the DataModel instance.
@@ -343,12 +279,18 @@ declare abstract class DataField<
343
279
  * @param model - The DataModel instance that this field belongs to
344
280
  * @param options - Initialization options
345
281
  * @returns An initialized copy of the source data
282
+ * @remarks Core fields that return a function:
283
+ * - {@link ForeignDocumentField | `ForeignDocumentField`}
284
+ * - `ActorDeltaField` (exported in the BaseToken file but not re-exported by the relevant `_module`, so unlinkable)
346
285
  */
286
+ // TODO: investigate narrowing return to just `InitializedType` on inheritance lines that don't possibly return one
287
+ // TODO: (everything except SchemaField and ObjectField and their descendants)
288
+ // options: not null (parameter default only)
347
289
  initialize(
348
290
  value: PersistedType,
349
291
  model: DataModel.Any,
350
- options?: AnyObject, // TODO: Type further.
351
- ): (() => InitializedType | null) | InitializedType;
292
+ options?: DataField.InitializeOptions,
293
+ ): InitializedType | (() => InitializedType | null);
352
294
 
353
295
  /**
354
296
  * Export the current value of the field into a serializable object.
@@ -361,7 +303,7 @@ declare abstract class DataField<
361
303
  * Recursively traverse a schema and retrieve a field specification by a given path
362
304
  * @param path - The field path as an array of strings
363
305
  */
364
- protected _getField(path: string[]): unknown; // TODO: Type further.
306
+ protected _getField(path: string[]): DataField.Any | undefined;
365
307
 
366
308
  /**
367
309
  * Does this form field class have defined form support?
@@ -403,7 +345,7 @@ declare abstract class DataField<
403
345
  * @param change - The change to apply.
404
346
  * @returns The updated value.
405
347
  */
406
- applyChange(value: InitializedType, model: DataModel.Any, change: EffectChangeData): InitializedType;
348
+ applyChange(value: InitializedType, model: DataModel.Any, change: ActiveEffect.EffectChangeData): InitializedType;
407
349
 
408
350
  /**
409
351
  * Cast a change delta into an appropriate type to be applied to this field.
@@ -421,13 +363,15 @@ declare abstract class DataField<
421
363
  * @param model - The model instance.
422
364
  * @param change - The original change data.
423
365
  * @returns - The updated value.
366
+ *
367
+ * @remarks Returns `value + delta`. `model` and `change` are unused in `DataField`
424
368
  */
425
369
  protected _applyChangeAdd(
426
370
  value: InitializedType,
427
371
  delta: InitializedType,
428
372
  model: DataModel.Any,
429
- change: EffectChangeData,
430
- ): InitializedType | undefined;
373
+ change: ActiveEffect.EffectChangeData,
374
+ ): InitializedType;
431
375
 
432
376
  /**
433
377
  * Apply a MULTIPLY change to this field.
@@ -436,12 +380,14 @@ declare abstract class DataField<
436
380
  * @param model - The model instance.
437
381
  * @param change - The original change data.
438
382
  * @returns The updated value.
383
+ *
384
+ * @remarks No-op in `DataField`, returns `undefined` unless overridden
439
385
  */
440
386
  protected _applyChangeMultiply(
441
387
  value: InitializedType,
442
388
  delta: InitializedType,
443
389
  model: DataModel.Any,
444
- change: EffectChangeData,
390
+ change: ActiveEffect.EffectChangeData,
445
391
  ): InitializedType | undefined;
446
392
 
447
393
  /**
@@ -451,13 +397,15 @@ declare abstract class DataField<
451
397
  * @param model - The model instance.
452
398
  * @param change - The original change data.
453
399
  * @returns The updated value.
400
+ *
401
+ * @returns Simply returns `delta`. `value`, `model`, and `change` are unused in `DataField`
454
402
  */
455
403
  protected _applyChangeOverride(
456
404
  value: InitializedType,
457
405
  delta: InitializedType,
458
406
  model: DataModel.Any,
459
- change: EffectChangeData,
460
- ): InitializedType | undefined;
407
+ change: ActiveEffect.EffectChangeData,
408
+ ): InitializedType;
461
409
 
462
410
  /**
463
411
  * Apply an UPGRADE change to this field.
@@ -466,12 +414,14 @@ declare abstract class DataField<
466
414
  * @param model - The model instance.
467
415
  * @param change - The original change data.
468
416
  * @returns - The updated value.
417
+ *
418
+ * @remarks No-op in `DataField`, returns `undefined` unless overridden
469
419
  */
470
420
  protected _applyChangeUpgrade(
471
421
  value: InitializedType,
472
422
  delta: InitializedType,
473
423
  model: DataModel.Any,
474
- change: EffectChangeData,
424
+ change: ActiveEffect.EffectChangeData,
475
425
  ): InitializedType | undefined;
476
426
 
477
427
  /**
@@ -481,12 +431,14 @@ declare abstract class DataField<
481
431
  * @param model - The model instance.
482
432
  * @param change - The original change data.
483
433
  * @returns The updated value.
434
+ *
435
+ * @remarks No-op in `DataField`, returns `undefined` unless overridden
484
436
  */
485
437
  protected _applyChangeDowngrade(
486
438
  value: InitializedType,
487
439
  delta: InitializedType,
488
440
  model: DataModel.Any,
489
- change: EffectChangeData,
441
+ change: ActiveEffect.EffectChangeData,
490
442
  ): InitializedType | undefined;
491
443
 
492
444
  /**
@@ -496,20 +448,20 @@ declare abstract class DataField<
496
448
  * @param model - The model instance.
497
449
  * @param change - The original change data.
498
450
  * @returns - The updated value.
451
+ * @remarks Only returns a value if the target value of the change actually changed
499
452
  */
500
453
  protected _applyChangeCustom(
501
454
  value: InitializedType,
502
455
  delta: InitializedType,
503
456
  model: DataModel.Any,
504
- change: EffectChangeData,
505
- ): InitializedType;
457
+ change: ActiveEffect.EffectChangeData,
458
+ ): InitializedType | undefined;
506
459
  }
507
460
 
508
461
  declare namespace DataField {
509
462
  /** Any DataField. */
510
- type Any = DataField<DataFieldOptions.Any, unknown, unknown, unknown>;
511
-
512
- type AnyConstructor = typeof AnyDataField;
463
+ interface Any extends AnyDataField {}
464
+ interface AnyConstructor extends Identity<typeof AnyDataField> {}
513
465
 
514
466
  /** A DataField with unknown inner types. */
515
467
  type Unknown = DataField<any, unknown, unknown, unknown>;
@@ -523,7 +475,7 @@ declare namespace DataField {
523
475
  type PersistedTypeFor<ConcreteDataField extends Any> =
524
476
  ConcreteDataField extends DataField<any, any, any, infer PersistedType> ? PersistedType : never;
525
477
 
526
- /** The type of the default options for the {@link DataField} class. */
478
+ /** The type of the default options for the {@link DataField | `DataField`} class. */
527
479
  interface DefaultOptions {
528
480
  required: false;
529
481
  nullable: false;
@@ -535,18 +487,90 @@ declare namespace DataField {
535
487
  validationError: "is not a valid value";
536
488
  }
537
489
 
490
+ interface Options<BaseAssignmentType> {
491
+ /**
492
+ * Is this field required to be populated?
493
+ * @defaultValue `false`
494
+ */
495
+ required?: boolean | undefined;
496
+
497
+ /**
498
+ * Can this field have null values?
499
+ * @defaultValue `false`
500
+ */
501
+ nullable?: boolean | undefined;
502
+
503
+ /**
504
+ * Can this field only be modified by a gamemaster or assistant gamemaster?
505
+ * @defaultValue `false`
506
+ */
507
+ gmOnly?: boolean | undefined;
508
+
509
+ /** The initial value of a field, or a function which assigns that initial value. */
510
+ initial?:
511
+ | DataField.Options.InitialType<
512
+ // TODO(LukeAbby): Add a `ValidateOptions` type or something of that sort in order to
513
+ // catch incorrect initial types.
514
+ DataField.Options.InitialReturnType<BaseAssignmentType, boolean, boolean>
515
+ >
516
+ | undefined;
517
+
518
+ /** A data validation function which accepts one argument with the current value. */
519
+ validate?: DataField.Validator<DataField.Any, BaseAssignmentType> | undefined;
520
+
521
+ /** A localizable label displayed on forms which render this field. */
522
+ label?: string | undefined;
523
+
524
+ /** Localizable help text displayed on forms which render this field. */
525
+ hint?: string | undefined;
526
+
527
+ /**
528
+ * A custom validation error string. When displayed will be prepended with the
529
+ * document name, field name, and candidate value. This error string is only
530
+ * used when the return type of the validate function is a boolean. If an Error
531
+ * is thrown in the validate function, the string message of that Error is used.
532
+ */
533
+ validationError?: string | undefined;
534
+ }
535
+
536
+ namespace Options {
537
+ /** Any DataField.Options. */
538
+ // Note(LukeAbby): This `& object` is intentional. Its purpose is to allow options like `{ integer: true }` to be assigned.
539
+ // This is an issue because `{ integer: true }` does not extend `{ required?: boolean }` because they have no properties in common.
540
+ // Even though `{ integer: true, required: undefined }` would extend `{ required?: boolean }` following the regular rules of surplus properties being allowed.
541
+ // `object` was chosen over `AnyObject` so that people may pass in interfaces.
542
+ interface Any extends DataField.Options<any>, Identity<object> {}
543
+
544
+ /**
545
+ * A helper type for the {@link DataField.Options.initial | `DataField.Options.initial`} option.
546
+ * @typeParam ReturnType - the return type of the option
547
+ */
548
+ type InitialType<ReturnType> = ReturnType | ((initialData: unknown) => ReturnType);
549
+
550
+ /**
551
+ * The decorated return type for the {@link DataField.Options.initial | `DataField.Options.initial`} option.
552
+ * @typeParam BaseAssignmentType - the base assignment type for a DataField
553
+ * @typeParam NullableOption - the value of the nullable option
554
+ * @typeParam RequiredOption - the value of the required option
555
+ */
556
+ type InitialReturnType<BaseAssignmentType, NullableOption, RequiredOption> =
557
+ | Exclude<BaseAssignmentType, null | undefined>
558
+ | (NullableOption extends true ? null : never)
559
+ | (RequiredOption extends true ? never : undefined);
560
+ }
561
+
538
562
  /**
539
563
  * A helper type for the given options type merged into the default options of the DataField class.
540
564
  * @typeParam Options - the options that override the default options
541
565
  */
542
- type MergedOptions<Options extends DataFieldOptions.Any> = SimpleMerge<DefaultOptions, Options>;
566
+ type MergedOptions<Options extends DataField.Options.Any> = SimpleMerge<DefaultOptions, Options>;
543
567
 
544
568
  /**
545
569
  * A type to decorate the base assignment type to a DataField, based on the options of the field.
546
570
  * @typeParam BaseAssignmentType - the base assignment type of the DataField, without null or undefined
547
571
  * @typeParam Options - the options of the DataField
548
572
  */
549
- type DerivedAssignmentType<BaseAssignmentType, Options extends DataFieldOptions.Any> =
573
+ type DerivedAssignmentType<BaseAssignmentType, Options extends DataField.Options.Any> =
550
574
  | Exclude<BaseAssignmentType, null | undefined> // Always include the base type
551
575
  | (Options["nullable"] extends true // determine whether null is in the union
552
576
  ? // when nullable, null is always allowed
@@ -576,7 +600,7 @@ declare namespace DataField {
576
600
  * @typeParam BaseInitializedType - the base initialized type of the DataField, without null or undefined
577
601
  * @typeParam Options - the options of the DataField
578
602
  */
579
- type DerivedInitializedType<BaseInitializedType, Options extends DataFieldOptions.Any> =
603
+ type DerivedInitializedType<BaseInitializedType, Options extends DataField.Options.Any> =
580
604
  | Exclude<BaseInitializedType, null | undefined>
581
605
  | (Options["nullable"] extends true ? null : never)
582
606
  | (Options["required"] extends true ? never : undefined);
@@ -585,24 +609,89 @@ declare namespace DataField {
585
609
  * A shorthand for the assignment type of a DataField class.
586
610
  * @typeParam Options - the options overriding the defaults
587
611
  */
588
- type AssignmentType<Options extends DataFieldOptions.Any> = DerivedAssignmentType<any, MergedOptions<Options>>;
612
+ type AssignmentType<Options extends DataField.Options.Any> = DerivedAssignmentType<any, MergedOptions<Options>>;
589
613
 
590
614
  /**
591
615
  * A shorthand for the initialized type of a DataField class.
592
616
  * @typeParam Options - the options overriding the defaults
593
617
  */
594
- type InitializedType<Options extends DataFieldOptions.Any> = DerivedInitializedType<any, MergedOptions<Options>>;
618
+ type InitializedType<Options extends DataField.Options.Any> = DerivedInitializedType<any, MergedOptions<Options>>;
595
619
 
596
- /** An interface for the options of the {@link DataField} clean functions. */
597
- interface CleanOptions {
620
+ /** @internal */
621
+ type _ConstructionContext = NullishProps<{
622
+ /** A field name to assign to the constructed field */
623
+ name?: string;
624
+ }> &
625
+ InexactPartial<{
626
+ /**
627
+ * Another data field which is a hierarchical parent of this one
628
+ * @remarks Can't be `null` as there's a `!== undefined` check in {@link SchemaField._initialize | `SchemaField#_initialize`}
629
+ */
630
+ parent?: DataField.Any;
631
+ }>;
632
+
633
+ interface ConstructionContext extends _ConstructionContext {}
634
+
635
+ /** @internal */
636
+ type _ValidationOptions = NullishProps<{
637
+ /** Whether this is a partial schema validation, or a complete one. */
638
+ partial: boolean;
639
+
640
+ /** Whether to allow replacing invalid values with valid fallbacks. */
641
+ fallback: boolean;
642
+
643
+ /**
644
+ * If true, invalid embedded documents will emit a warning and be placed in the invalidDocuments
645
+ * collection rather than causing the parent to be considered invalid.
646
+ */
647
+ dropInvalidEmbedded?: boolean;
648
+ }> &
649
+ InexactPartial<{
650
+ /**
651
+ * The full source object being evaluated.
652
+ * @privateRemarks Disallowing `null` as this value gets passed to provided `initial` functions,
653
+ * and users shouldn't have to expect `null`
654
+ */
655
+ source: AnyObject;
656
+ }>;
657
+
658
+ /**
659
+ * @remarks This is the type for the options for `#validate` and associate methods *without* the
660
+ * possible inclusion of a `validator` function.
661
+ *
662
+ * If you are looking for the type with a generic formerly under this name, see {@link ValidateOptions | `DataField.ValidateOptions`}
663
+ */
664
+ interface ValidationOptions extends _ValidationOptions {}
665
+
666
+ /**
667
+ * @deprecated Use {@link ValidateOptions | `DataField.ValidationOptions`} instead if you need a direct replacement,
668
+ * or {@link ValidateOptions | `DataField.ValidateOptions`} if you're typing the options of `#validate` or an associated
669
+ * method.
670
+ */
671
+ interface DataValidationOptions extends ValidationOptions {}
672
+
673
+ /** @internal */
674
+ type _CleanOptions = NullishProps<{
598
675
  /** Whether to perform partial cleaning? */
599
- partial?: boolean;
676
+ partial: boolean;
600
677
 
601
678
  /** The root data model being cleaned */
602
- source?: {
603
- type?: string;
604
- };
605
- }
679
+ source: AnyObject;
680
+ }>;
681
+
682
+ /** An interface for the options of {@link DataField.clean | `DataField#clean`} and {@link DataField._cleanType | `DataField#_cleanType`}. */
683
+ interface CleanOptions extends _CleanOptions {}
684
+
685
+ /**
686
+ * @remarks The only place core checks the `options` for any property is in {@link TypeDataField._validateModel | `TypeDataField#_validateModel`},
687
+ * where it checks `options.source?.type`
688
+ *
689
+ * {@link SchemaField._validateModel | `SchemaField._validateModel`} enforces `source`'s existence for subsidiary calls
690
+ *
691
+ * The only place core *calls* this at a top level, it does not pass anything for `options`, relying on SchemaField above
692
+ * to make TypeDataField work
693
+ */
694
+ interface ValidateModelOptions extends Pick<ValidationOptions, "source"> {}
606
695
 
607
696
  /**
608
697
  * A Custom DataField validator function.
@@ -615,31 +704,55 @@ declare namespace DataField {
615
704
  *
616
705
  * An Error may be thrown which provides a custom error message explaining the reason the value is invalid.
617
706
  */
618
- type Validator<BaseAssignmentType> = ToMethod<
619
- (
620
- this: DataField,
621
- // TODO(LukeAbby): Always allowing `null | undefined` may be too lenient but it's probably the best type for the time being.
622
- value: BaseAssignmentType | null | undefined,
623
- options: ValidationOptions<DataField>,
624
- ) => DataModelValidationFailure | boolean | void
625
- >;
707
+ type Validator<CurrentField extends DataField.Any, BaseAssignmentType> =
708
+ | {
709
+ validate(
710
+ this: CurrentField,
711
+ value: unknown,
712
+ options: ValidateOptions<CurrentField>,
713
+ ): value is BaseAssignmentType;
714
+ }["validate"]
715
+ | {
716
+ validate(
717
+ this: CurrentField,
718
+ value: unknown,
719
+ options: ValidateOptions<CurrentField>,
720
+ ): asserts value is BaseAssignmentType;
721
+ }["validate"]
722
+ | {
723
+ validate(
724
+ this: CurrentField,
725
+ value: unknown,
726
+ options: ValidateOptions<CurrentField>,
727
+ ): DataModelValidationFailure | boolean | void;
728
+ }["validate"];
626
729
 
627
730
  /**
628
- * An interface for the options of the {@link DataField} validation functions.
629
- * @typeParam DataField - the type of the DataField, which is the receiver of the validate function
731
+ * An interface for the options of the {@link DataField | `DataField`} validation functions.
732
+ * @typeParam CurrentField - the type of the DataField, which is the receiver of the validate function
630
733
  */
631
- interface ValidationOptions<DataField extends DataField.Any> extends DataValidationOptions {
632
- source?: AnyObject;
633
- validate?: Validator<DataField.AssignmentTypeFor<DataField>>;
734
+ interface ValidateOptions<CurrentField extends DataField.Any> extends ValidationOptions {
735
+ /**
736
+ * @remarks If {@link DataField.validate | `DataField#validate`} is called with a `validate: someFunc` in its `options`,
737
+ * it will then pass that `options` object on to that function when it calls it, without alteration.
738
+ * Nothing in core makes use of the fact that a reference to the function is available, this seems incidental.
739
+ */
740
+ validate?: Validator<CurrentField, DataField.AssignmentTypeFor<CurrentField>>;
634
741
  }
635
742
 
636
- interface Context {
637
- /** A field name to assign to the constructed field */
638
- name: string;
639
-
640
- /** Another data field which is a hierarchical parent of this one */
641
- parent: DataField.Any;
642
- }
743
+ /**
744
+ * @remarks The `options` passed to {@link DataField.initialize | `DataField#initialize`} exclusively (in core) come from
745
+ * {@link DataModel._initialize | `DataModel#_initialize`} or an override (meaning `parent` has been stripped from the
746
+ * interface), and eventually hits one of:
747
+ * 1. Document construction, in all cases with `parent` already provided
748
+ * 2. Gets fed back {@link DataModel._initialize | `DataModel#_initialize`} or an override
749
+ * 3. {@link Document.get | `Document.get`}, but the one place this happens, `pack` is already provided, and that's the only
750
+ * option that method cares about.
751
+ *
752
+ * This extends the `Document` interface because several core fields use the `pack` property, which isn't available on the
753
+ * `DataModel` interface
754
+ */
755
+ interface InitializeOptions extends Document.InitializeOptions {}
643
756
 
644
757
  interface ToInputConfig<InitializedType> extends FormInputConfig<InitializedType> {}
645
758
 
@@ -662,11 +775,11 @@ declare namespace DataField {
662
775
  }
663
776
 
664
777
  declare abstract class AnyDataField extends DataField<any, any, any, any> {
665
- constructor(arg0: never, ...args: never[]);
778
+ constructor(...args: never);
666
779
  }
667
780
 
668
781
  /**
669
- * A special class of {@link DataField} which defines a data schema.
782
+ * A special class of {@link DataField | `DataField`} which defines a data schema.
670
783
  * @typeParam Fields - the DataSchema fields of the SchemaField
671
784
  * @typeParam Options - the options of the SchemaField instance
672
785
  * @typeParam AssignmentType - the type of the allowed assignment values of the SchemaField
@@ -674,16 +787,16 @@ declare abstract class AnyDataField extends DataField<any, any, any, any> {
674
787
  * @typeParam PersistedType - the type of the persisted values of the SchemaField
675
788
  * @remarks
676
789
  * Defaults:
677
- * AssignmentType: `SchemaField.AssignmentType<Fields> | null | undefined`
678
- * InitializedType: `SchemaField.InitializedType<Fields>`
679
- * PersistedType: `SchemaField.PersistedType<Fields>`
790
+ * - AssignmentType: `SchemaField.AssignmentType<Fields> | null | undefined`
791
+ * - InitializedType: `SchemaField.InitializedType<Fields>`
792
+ * - PersistedType: `SchemaField.PersistedType<Fields>`
680
793
  */
681
794
  declare class SchemaField<
682
795
  Fields extends DataSchema,
683
796
  Options extends SchemaField.Options<Fields> = SchemaField.DefaultOptions,
684
- AssignmentType = SchemaField.AssignmentType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
685
- InitializedType = SchemaField.InitializedType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
686
- PersistedType extends AnyObject | null | undefined = SchemaField.PersistedType<
797
+ AssignmentType = SchemaField.Internal.AssignmentType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
798
+ InitializedType = SchemaField.Internal.InitializedType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
799
+ PersistedType extends AnyObject | null | undefined = SchemaField.Internal.PersistedType<
687
800
  Fields,
688
801
  SimpleMerge<Options, SchemaField.DefaultOptions>
689
802
  >,
@@ -691,9 +804,11 @@ declare class SchemaField<
691
804
  /**
692
805
  * @param fields - The contained field definitions
693
806
  * @param options - Options which configure the behavior of the field
807
+ * @param context - Additional context which describes the field
694
808
  */
695
809
  // Saying `fields: Fields` here causes the inference for the fields to be unnecessarily widened. This might effectively be a no-op but it fixes the inference.
696
- constructor(fields: { [K in keyof Fields]: Fields[K] }, options?: Options, context?: DataField.Context);
810
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
811
+ constructor(fields: { [K in keyof Fields]: Fields[K] }, options?: Options, context?: DataField.ConstructionContext);
697
812
 
698
813
  /** @defaultValue `true` */
699
814
  override required: boolean;
@@ -702,7 +817,7 @@ declare class SchemaField<
702
817
  override nullable: boolean;
703
818
 
704
819
  /** @defaultValue `() => this.clean({})` */
705
- override initial: DataFieldOptions.InitialType<InitializedType>;
820
+ override initial: DataField.Options.InitialType<InitializedType>;
706
821
 
707
822
  protected static override get _defaults(): SchemaField.Options<DataSchema>;
708
823
 
@@ -726,6 +841,7 @@ declare class SchemaField<
726
841
  */
727
842
  [Symbol.iterator](): Generator<DataField.Unknown>;
728
843
 
844
+ // TODO: see if its viable to narrow keys, values, entries, has, and get's types via the schema
729
845
  /**
730
846
  * An array of field names which are present in the schema.
731
847
  */
@@ -762,35 +878,40 @@ declare class SchemaField<
762
878
  */
763
879
  getField(fieldName: string | string[]): DataField.Unknown | undefined;
764
880
 
765
- protected override _getField(path: string[]): DataField.Unknown;
881
+ protected override _getField(path: string[]): DataField.Any;
766
882
 
767
883
  protected override _cast(value: AssignmentType): InitializedType;
768
884
 
885
+ /**
886
+ * @remarks Ensures `options.source` is set via effectively `||= data`, then forwards to each field's `#clean`
887
+ *
888
+ * Deletes any keys from `value` not in the schema
889
+ */
890
+ // options: not null (parameter default only, property access)
769
891
  protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
770
892
 
893
+ // options: not null (parameter default only)
771
894
  override initialize(
772
895
  value: PersistedType,
773
896
  model: DataModel.Any,
774
- options?: AnyObject,
897
+ options?: DataField.InitializeOptions,
775
898
  ): InitializedType | (() => InitializedType | null);
776
899
 
900
+ // options: not null (parameter default only, property access)
777
901
  protected override _validateType(
778
902
  value: InitializedType,
779
- options?: DataField.ValidationOptions<DataField.Any>,
903
+ options?: DataField.ValidateOptions<this>,
780
904
  ): boolean | DataModelValidationFailure | void;
781
905
 
782
- protected override _validateModel(data: AnyObject, options?: AnyObject): void;
906
+ // options: not null (parameter default only, property access)
907
+ protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
783
908
 
784
909
  override toObject(value: InitializedType): PersistedType;
785
910
 
911
+ // options: not null (could be forwarded somewhere destructured, parameter default only)
786
912
  override apply<Options, Return>(
787
- fn: keyof this | ((this: this, value: undefined | null, options: Options) => Return),
788
- value?: undefined | null,
789
- options?: Options,
790
- ): Return;
791
- override apply<Value, Options, Return>(
792
- fn: keyof this | ((this: this, value: Value, options: Options) => Return),
793
- value: Value,
913
+ fn: keyof this | ((this: this, value: AnyObject, options: Options) => Return),
914
+ value?: AnyObject,
794
915
  options?: Options,
795
916
  ): Return;
796
917
 
@@ -803,7 +924,7 @@ declare class SchemaField<
803
924
  }
804
925
 
805
926
  // FIXME(LukeAbby): This is a quick patch that avoids issues with the fact that the `initial` in `SchemaField` is not actually assignable to its assignment type etc.
806
- // This will be superceded once proper field treatment is applied.
927
+ // This will be superseded once proper field treatment is applied.
807
928
  declare const __SchemaFieldInitialSymbol: unique symbol;
808
929
 
809
930
  type __SchemaFieldInitial = typeof __SchemaFieldInitialSymbol;
@@ -813,64 +934,97 @@ declare namespace SchemaField {
813
934
  * A shorthand for the options of a SchemaField class.
814
935
  * @typeParam Fields - the DataSchema fields of the SchemaField
815
936
  */
816
- type Options<Fields extends DataSchema> = DataFieldOptions<InnerAssignmentType<Fields> | __SchemaFieldInitial>;
937
+ type Options<Fields extends DataSchema> = DataField.Options<AssignmentData<Fields> | __SchemaFieldInitial>;
817
938
 
818
939
  /** Any SchemaField. */
819
- type Any = SchemaField<any, any, any, any, any>;
940
+ interface Any extends SchemaField<any, any, any, any, any> {}
820
941
 
821
942
  /**
822
943
  * Get the constructor type for the given DataSchema.
823
944
  * @typeParam Fields - the DataSchema fields of the SchemaField
824
945
  */
825
- type InnerConstructorType<Fields extends DataSchema> = InnerAssignmentType<Fields>;
946
+ // Note(LukeAbby): Currently this is identical to the assignment type. The intent is to make this
947
+ // More accurate in the future, e.g. requiring some requisite properties.
948
+ type CreateData<Fields extends DataSchema> = AssignmentData<Fields>;
826
949
 
827
950
  /**
828
951
  * Get the inner assignment type for the given DataSchema.
829
952
  * @typeParam Fields - the DataSchema fields of the SchemaField
830
953
  */
831
- type InnerAssignmentType<Fields extends DataSchema> = RemoveIndexSignatures<{
832
- [Key in keyof Fields]?: Fields[Key] extends EmbeddedDataField<any, any, infer AssignmentType, any, any>
833
- ? AssignmentType
834
- : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
835
- ? // FIXME(LukeAbby): This is a quick hack into InnerAssignmentType that assumes that the `initial` of `SchemaField` is not changed from the default of `{}`
836
- // This will be fixed with the refactoring of the types
837
- EmptyObject extends InnerAssignmentType<SubSchema>
838
- ? InnerAssignmentType<SubSchema> | undefined | null
839
- : InnerAssignmentType<SubSchema>
840
- : Fields[Key] extends DataField<any, infer AssignType, any, any>
841
- ? AssignType
842
- : never;
843
- }>;
954
+ type AssignmentData<Fields extends DataSchema> = PrettifyType<
955
+ RemoveIndexSignatures<{
956
+ [Key in keyof Fields]?: Fields[Key] extends EmbeddedDataField<any, any, infer AssignmentType, any, any>
957
+ ? AssignmentType
958
+ : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
959
+ ? // FIXME(LukeAbby): This is a quick hack into AssignmentData that assumes that the `initial` of `SchemaField` is not changed from the default of `{}`
960
+ // This will be fixed with the refactoring of the types
961
+ EmptyObject extends AssignmentData<SubSchema>
962
+ ? AssignmentData<SubSchema> | undefined | null
963
+ : AssignmentData<SubSchema>
964
+ : Fields[Key] extends DataField<any, infer AssignType, any, any>
965
+ ? AssignType
966
+ : never;
967
+ }>
968
+ >;
844
969
 
845
970
  /**
846
- * Get the inner initialized type for the given DataSchema.
971
+ * The required type of data used when updating a document.
847
972
  * @typeParam Fields - the DataSchema fields of the SchemaField
848
973
  */
849
- type InnerInitializedType<Fields extends DataSchema> = RemoveIndexSignatures<{
850
- [Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<infer Model, any, any, any, any>
851
- ? InstanceType<Model>
852
- : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
853
- ? InnerInitializedType<SubSchema>
854
- : Fields[Key] extends DataField<any, any, infer InitType, any>
855
- ? InitType
856
- : never;
857
- }>;
974
+ // Note(LukeAbby): Currently this is identical to `AssignmentData` but the intent is to make it
975
+ // more accurate in the future.
976
+ type UpdateData<Fields extends DataSchema> = AssignmentData<Fields>;
858
977
 
859
978
  /**
860
- * Get the inner persisted type for the given DataSchema.
979
+ * Gets the initialized version of a schema. This means a
861
980
  * @typeParam Fields - the DataSchema fields of the SchemaField
862
981
  */
863
- type InnerPersistedType<Fields extends DataSchema> = RemoveIndexSignatures<{
864
- [Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<any, any, any, any, infer PersistType>
865
- ? PersistType
866
- : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
867
- ? InnerPersistedType<SubSchema>
868
- : Fields[Key] extends DataField<any, any, any, infer PersistType>
869
- ? PersistType
870
- : never;
871
- }>;
982
+ type InitializedData<Fields extends DataSchema> = PrettifyType<
983
+ RemoveIndexSignatures<{
984
+ [Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<infer Model, any, any, any, any>
985
+ ? FixedInstanceType<Model>
986
+ : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
987
+ ? InitializedData<SubSchema>
988
+ : Fields[Key] extends DataField<any, any, infer InitType, any>
989
+ ? InitType
990
+ : never;
991
+ }>
992
+ >;
993
+
994
+ /**
995
+ * @deprecated {@link SourceData | `SourceData`}
996
+ */
997
+ type PersistedData<Fields extends DataSchema> = SourceData<Fields>;
998
+
999
+ /**
1000
+ * Get the persisted type for the given DataSchema. This is the type used for source.
1001
+ * @typeParam Fields - the DataSchema fields of the SchemaField
1002
+ */
1003
+ type SourceData<Fields extends DataSchema> = PrettifyType<
1004
+ RemoveIndexSignatures<{
1005
+ [Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<any, any, any, any, infer PersistType>
1006
+ ? PersistType
1007
+ : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
1008
+ ? SourceData<SubSchema>
1009
+ : Fields[Key] extends DataField<any, any, any, infer PersistType>
1010
+ ? PersistType
1011
+ : never;
1012
+ }>
1013
+ >;
1014
+
1015
+ type UpdateSourceData<Fields extends DataSchema> = PrettifyType<
1016
+ RemoveIndexSignatures<{
1017
+ [Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<any, any, any, any, infer PersistType>
1018
+ ? PersistType
1019
+ : Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
1020
+ ? SourceData<SubSchema>
1021
+ : Fields[Key] extends DataField<any, any, any, infer PersistType>
1022
+ ? PersistType
1023
+ : never;
1024
+ }>
1025
+ >;
872
1026
 
873
- /** The type of the default options for the {@link SchemaField} class. */
1027
+ /** The type of the default options for the {@link SchemaField | `SchemaField`} class. */
874
1028
  type DefaultOptions = SimpleMerge<
875
1029
  DataField.DefaultOptions,
876
1030
  {
@@ -887,50 +1041,107 @@ declare namespace SchemaField {
887
1041
  */
888
1042
  type MergedOptions<Fields extends DataSchema, Opts extends Options<Fields>> = SimpleMerge<DefaultOptions, Opts>;
889
1043
 
890
- // FIXME: null or undefined should be permissible, cast as the initialized type
1044
+ // These exist for calculating the type of schema field with options.
1045
+ // This will be deleted once fields are refactored.
1046
+ // The names are also confusing. Hence these it's put into `Internal.
1047
+ namespace Internal {
1048
+ // FIXME: null or undefined should be permissible, cast as the initialized type
1049
+ /**
1050
+ * A shorthand for the assignment type of a SchemaField class.
1051
+ * @typeParam Fields - the DataSchema fields of the SchemaField
1052
+ * @typeParam Opts - the options that override the default options
1053
+ */
1054
+ type AssignmentType<
1055
+ Fields extends DataSchema,
1056
+ Opts extends Options<Fields> = DefaultOptions,
1057
+ > = DataField.DerivedAssignmentType<AssignmentData<Fields>, MergedOptions<Fields, Opts>>;
1058
+
1059
+ /**
1060
+ * A shorthand for the assignment type of a SchemaField class.
1061
+ * @typeParam Fields - the DataSchema fields of the SchemaField
1062
+ * @typeParam Opts - the options that override the default options
1063
+ */
1064
+ type InitializedType<
1065
+ Fields extends DataSchema,
1066
+ Opts extends Options<Fields> = DefaultOptions,
1067
+ > = DataField.DerivedInitializedType<InitializedData<Fields>, MergedOptions<Fields, Opts>>;
1068
+
1069
+ /**
1070
+ * A shorthand for the assignment type of a SchemaField class.
1071
+ * @typeParam Fields - the DataSchema fields of the SchemaField
1072
+ * @typeParam Opts - the options that override the default options
1073
+ */
1074
+ type PersistedType<
1075
+ Fields extends DataSchema,
1076
+ Opts extends Options<Fields> = DefaultOptions,
1077
+ > = DataField.DerivedInitializedType<SourceData<Fields>, MergedOptions<Fields, Opts>>;
1078
+ }
1079
+
891
1080
  /**
892
- * A shorthand for the assignment type of a SchemaField class.
893
- * @typeParam Fields - the DataSchema fields of the SchemaField
894
- * @typeParam Opts - the options that override the default options
1081
+ * This is deprecated because of likely confusion between `SchemaField.AssignmentData` and `SchemaField.AssignmentType`.
1082
+ * @deprecated {@link SchemaField.Internal.AssignmentType | `SchemaField.Internal.AssignmentType`}
895
1083
  */
896
1084
  type AssignmentType<
897
1085
  Fields extends DataSchema,
898
1086
  Opts extends Options<Fields> = DefaultOptions,
899
- > = DataField.DerivedAssignmentType<InnerAssignmentType<Fields>, MergedOptions<Fields, Opts>>;
1087
+ > = Internal.AssignmentType<Fields, Opts>;
900
1088
 
901
1089
  /**
902
- * A shorthand for the assignment type of a SchemaField class.
903
- * @typeParam Fields - the DataSchema fields of the SchemaField
904
- * @typeParam Opts - the options that override the default options
1090
+ * This is deprecated because of likely confusion between `SchemaField.InitializedData` and `SchemaField.InitializedType`.
1091
+ * @deprecated {@link SchemaField.Internal.InitializedType | `SchemaField.Internal.InitializedType`}
905
1092
  */
906
1093
  type InitializedType<
907
1094
  Fields extends DataSchema,
908
1095
  Opts extends Options<Fields> = DefaultOptions,
909
- > = DataField.DerivedInitializedType<InnerInitializedType<Fields>, MergedOptions<Fields, Opts>>;
1096
+ > = Internal.InitializedType<Fields, Opts>;
910
1097
 
911
1098
  /**
912
- * A shorthand for the assignment type of a SchemaField class.
913
- * @typeParam Fields - the DataSchema fields of the SchemaField
914
- * @typeParam Opts - the options that override the default options
1099
+ * This is deprecated because of likely confusion between `SchemaField.PersistedData` and `SchemaField.PersistedType`.
1100
+ * @deprecated {@link SchemaField.Internal.PersistedType | `SchemaField.Internal.PersistedType`}
915
1101
  */
916
- type PersistedType<
917
- Fields extends DataSchema,
918
- Opts extends Options<Fields> = DefaultOptions,
919
- > = DataField.DerivedInitializedType<InnerPersistedType<Fields>, MergedOptions<Fields, Opts>>;
1102
+ type PersistedType<Fields extends DataSchema, Opts extends Options<Fields> = DefaultOptions> = Internal.PersistedType<
1103
+ Fields,
1104
+ Opts
1105
+ >;
1106
+
1107
+ /**
1108
+ * @deprecated {@link SchemaField.CreateData | `SchemaField.CreateData`}
1109
+ */
1110
+ type InnerConstructorType<Fields extends DataSchema> = CreateData<Fields>;
1111
+
1112
+ /**
1113
+ * @deprecated {@link SchemaField.AssignmentData | `SchemaField.AssignmentData`}
1114
+ */
1115
+ type InnerAssignmentType<Fields extends DataSchema> = AssignmentData<Fields>;
1116
+
1117
+ /**
1118
+ * @deprecated {@link SchemaField.InitializedData | `SchemaField.InitializedData`}
1119
+ */
1120
+ type InnerInitializedType<Fields extends DataSchema> = InitializedData<Fields>;
1121
+
1122
+ /**
1123
+ * @deprecated {@link SchemaField.UpdateData | `SchemaField.UpdateData`}
1124
+ */
1125
+ type InnerUpdateData<Fields extends DataSchema> = UpdateData<Fields>;
1126
+
1127
+ /**
1128
+ * @deprecated {@link SchemaField.SourceData | `SchemaField.SourceData`}
1129
+ */
1130
+ type InnerPersistedType<Fields extends DataSchema> = SourceData<Fields>;
920
1131
  }
921
1132
 
922
1133
  /**
923
- * A subclass of [DataField]{@link DataField} which deals with boolean-typed data.
1134
+ * A subclass of {@link DataField | `DataField`} which deals with boolean-typed data.
924
1135
  * @typeParam Options - the options of the BooleanField instance
925
1136
  * @typeParam AssignmentType - the type of the allowed assignment values of the BooleanField
926
1137
  * @typeParam InitializedType - the type of the initialized values of the BooleanField
927
1138
  * @typeParam PersistedType - the type of the persisted values of the BooleanField
928
1139
  * @remarks
929
1140
  * Defaults:
930
- * AssignmentType: `boolean | null | undefined`
931
- * InitializedType: `boolean`
932
- * PersistedType: `boolean`
933
- * InitialValue: `false`
1141
+ * - AssignmentType: `boolean | null | undefined`
1142
+ * - InitializedType: `boolean`
1143
+ * - PersistedType: `boolean`
1144
+ * - InitialValue: `false`
934
1145
  */
935
1146
  declare class BooleanField<
936
1147
  const Options extends BooleanField.Options = BooleanField.DefaultOptions,
@@ -947,25 +1158,58 @@ declare class BooleanField<
947
1158
  override nullable: boolean;
948
1159
 
949
1160
  /** @defaultValue `false` */
950
- override initial: DataFieldOptions.InitialType<InitializedType>;
1161
+ override initial: DataField.Options.InitialType<InitializedType>;
951
1162
 
952
1163
  protected static override get _defaults(): BooleanField.Options;
953
1164
 
954
1165
  protected override _cast(value: AssignmentType): InitializedType;
955
1166
 
1167
+ /** @remarks `options` is unused in `BooleanField` */
956
1168
  protected override _validateType(
957
1169
  value: InitializedType,
958
- options?: DataField.ValidationOptions<DataField.Any>,
1170
+ options?: DataField.ValidateOptions<this> | null,
959
1171
  ): boolean | DataModelValidationFailure | void;
960
1172
 
961
1173
  protected override _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
1174
+
1175
+ /** @remarks Returns `value || delta`. `model` and `change` are unused in `BooleanField` */
1176
+ protected override _applyChangeAdd(
1177
+ value: InitializedType,
1178
+ delta: InitializedType,
1179
+ model: DataModel.Any,
1180
+ change: ActiveEffect.EffectChangeData,
1181
+ ): InitializedType;
1182
+
1183
+ /** @remarks Returns `value && delta`. `model` and `change` are unused in `BooleanField` */
1184
+ protected override _applyChangeMultiply(
1185
+ value: InitializedType,
1186
+ delta: InitializedType,
1187
+ model: DataModel.Any,
1188
+ change: ActiveEffect.EffectChangeData,
1189
+ ): InitializedType;
1190
+
1191
+ /** @remarks Returns `delta > value ? delta : value`. `model` and `change` are unused in `BooleanField` */
1192
+ protected override _applyChangeUpgrade(
1193
+ value: InitializedType,
1194
+ delta: InitializedType,
1195
+ model: DataModel.Any,
1196
+ change: ActiveEffect.EffectChangeData,
1197
+ ): InitializedType;
1198
+
1199
+ /** @remarks Returns `delta < value ? delta : value`. `model` and `change` are unused in `BooleanField` */
1200
+ protected override _applyChangeDowngrade(
1201
+ value: InitializedType,
1202
+ delta: InitializedType,
1203
+ model: DataModel.Any,
1204
+ change: ActiveEffect.EffectChangeData,
1205
+ ): InitializedType;
962
1206
  }
963
1207
 
964
1208
  declare namespace BooleanField {
965
1209
  /** A shorthand for the options of a BooleanField class. */
966
- type Options = DataFieldOptions<boolean>;
1210
+ type Options = DataField.Options<boolean>;
967
1211
 
968
- /** The type of the default options for the {@link BooleanField} class. */
1212
+ /** The type of the default options for the {@link BooleanField | `BooleanField`} class. */
969
1213
  type DefaultOptions = SimpleMerge<
970
1214
  DataField.DefaultOptions,
971
1215
  {
@@ -994,76 +1238,40 @@ declare namespace BooleanField {
994
1238
  type InitializedType<Opts extends Options> = DataField.DerivedInitializedType<boolean, MergedOptions<Opts>>;
995
1239
  }
996
1240
 
997
- declare global {
998
- interface NumberFieldOptions extends DataFieldOptions<number> {
999
- /**
1000
- * A minimum allowed value
1001
- * @defaultValue `undefined`
1002
- */
1003
- min?: number | undefined;
1004
-
1005
- /**
1006
- * A maximum allowed value
1007
- * @defaultValue `undefined`
1008
- */
1009
- max?: number | undefined;
1010
-
1011
- /**
1012
- * A permitted step size
1013
- * @defaultValue `undefined`
1014
- */
1015
- step?: number | undefined;
1016
-
1017
- /**
1018
- * Must the number be an integer?
1019
- * @defaultValue `false`
1020
- */
1021
- integer?: boolean | undefined;
1022
-
1023
- /**
1024
- * Must the number be positive?
1025
- * @defaultValue `false`
1026
- */
1027
- positive?: boolean | undefined;
1028
-
1029
- /**
1030
- * An array of values or an object of values/labels which represent
1031
- * allowed choices for the field. A function may be provided which dynamically
1032
- * returns the array of choices.
1033
- * @defaultValue `undefined`
1034
- */
1035
- choices?: NumberField.Choices | undefined;
1036
- }
1037
- }
1038
-
1039
1241
  /**
1040
- * A subclass of [DataField]{@link DataField} which deals with number-typed data.
1242
+ * A subclass of {@link DataField | `DataField`} which deals with number-typed data.
1041
1243
  * @typeParam Options - the options of the NumberField instance
1042
1244
  * @typeParam AssignmentType - the type of the allowed assignment values of the NumberField
1043
1245
  * @typeParam InitializedType - the type of the initialized values of the NumberField
1044
1246
  * @typeParam PersistedType - the type of the persisted values of the NumberField
1045
1247
  * @remarks
1046
1248
  * Defaults:
1047
- * AssignmentType: `number | null | undefined`
1048
- * InitializedType: `number | null`
1049
- * PersistedType: `number | null`
1050
- * InitialValue: `null`
1249
+ * - AssignmentType: `number | null | undefined`
1250
+ * - InitializedType: `number | null`
1251
+ * - PersistedType: `number | null`
1252
+ * - InitialValue: `null`
1051
1253
  */
1052
1254
  declare class NumberField<
1053
- const Options extends NumberFieldOptions = NumberField.DefaultOptions,
1255
+ const Options extends NumberField.Options = NumberField.DefaultOptions,
1054
1256
  const AssignmentType = NumberField.AssignmentType<Options>,
1055
1257
  const InitializedType = NumberField.InitializedType<Options>,
1056
1258
  const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
1057
1259
  > extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
1058
1260
  /**
1059
1261
  * @param options - Options which configure the behavior of the field
1262
+ * @param context - Additional context which describes the field
1263
+ * @remarks Changes the default of `nullable` if passed `choices`
1060
1264
  */
1061
- constructor(options?: Options, context?: DataField.Context);
1265
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
1266
+ constructor(options?: Options, context?: DataField.ConstructionContext);
1062
1267
 
1063
1268
  /** @defaultValue `null` */
1064
- override initial: DataFieldOptions.InitialType<InitializedType>;
1269
+ override initial: DataField.Options.InitialType<InitializedType>;
1065
1270
 
1066
- /** @defaultValue `true` */
1271
+ /**
1272
+ * @defaultValue `true`
1273
+ * @remarks If this field is created with `choices`, the default becomes `false`
1274
+ */
1067
1275
  override nullable: boolean;
1068
1276
 
1069
1277
  /**
@@ -1104,24 +1312,23 @@ declare class NumberField<
1104
1312
  */
1105
1313
  choices: number[] | Record<number, string> | (() => number[] | Record<number, string>) | undefined;
1106
1314
 
1107
- protected static override get _defaults(): NumberFieldOptions;
1315
+ protected static override get _defaults(): NumberField.Options;
1108
1316
 
1109
1317
  protected override _cast(value: AssignmentType): InitializedType;
1110
1318
 
1111
- protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
1319
+ /**
1320
+ * @remarks Applies `integer`, `min`, `max`, and `step`
1321
+ *
1322
+ * `options` is only passed to super, so effectively unused
1323
+ * */
1324
+ protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
1112
1325
 
1326
+ /** @remarks `options` is unused in `NumberField` */
1113
1327
  protected override _validateType(
1114
1328
  value: InitializedType,
1115
- options?: DataField.ValidationOptions<DataField.Any>,
1329
+ options?: DataField.ValidateOptions<this> | null,
1116
1330
  ): boolean | DataModelValidationFailure | void;
1117
1331
 
1118
- /**
1119
- * Test whether a provided value is a valid choice from the allowed choice set
1120
- * @param value - The provided value
1121
- * @returns Is the choice valid?
1122
- */
1123
- #isValidChoice(value: AssignmentType): boolean;
1124
-
1125
1332
  // These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
1126
1333
  toFormGroup(
1127
1334
  groupConfig?: DataField.GroupConfig,
@@ -1152,10 +1359,34 @@ declare class NumberField<
1152
1359
  protected override _toInput(
1153
1360
  config: NumberField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
1154
1361
  ): HTMLElement | HTMLCollection;
1362
+
1363
+ /** @remarks Returns `value * delta`. `model` and `change` are unused in `NumberField` */
1364
+ protected override _applyChangeMultiply(
1365
+ value: InitializedType,
1366
+ delta: InitializedType,
1367
+ model: DataModel.Any,
1368
+ change: ActiveEffect.EffectChangeData,
1369
+ ): InitializedType;
1370
+
1371
+ /** @remarks Returns `delta > value ? delta : value`. `model` and `change` are unused in `NumberField` */
1372
+ protected override _applyChangeUpgrade(
1373
+ value: InitializedType,
1374
+ delta: InitializedType,
1375
+ model: DataModel.Any,
1376
+ change: ActiveEffect.EffectChangeData,
1377
+ ): InitializedType;
1378
+
1379
+ /** @remarks Returns `delta < value ? delta : value`. `model` and `change` are unused in `NumberField` */
1380
+ protected override _applyChangeDowngrade(
1381
+ value: InitializedType,
1382
+ delta: InitializedType,
1383
+ model: DataModel.Any,
1384
+ change: ActiveEffect.EffectChangeData,
1385
+ ): InitializedType;
1155
1386
  }
1156
1387
 
1157
1388
  declare namespace NumberField {
1158
- /** The type of the default options for the {@link NumberField} class. */
1389
+ /** The type of the default options for the {@link NumberField | `NumberField`} class. */
1159
1390
  type DefaultOptions = SimpleMerge<
1160
1391
  DataField.DefaultOptions,
1161
1392
  {
@@ -1170,14 +1401,54 @@ declare namespace NumberField {
1170
1401
  }
1171
1402
  >;
1172
1403
 
1173
- /** The type of the default options for the {@link NumberField} class when choices are provided. */
1404
+ interface Options extends DataField.Options<number> {
1405
+ /**
1406
+ * A minimum allowed value
1407
+ * @defaultValue `undefined`
1408
+ */
1409
+ min?: number | undefined;
1410
+
1411
+ /**
1412
+ * A maximum allowed value
1413
+ * @defaultValue `undefined`
1414
+ */
1415
+ max?: number | undefined;
1416
+
1417
+ /**
1418
+ * A permitted step size
1419
+ * @defaultValue `undefined`
1420
+ */
1421
+ step?: number | undefined;
1422
+
1423
+ /**
1424
+ * Must the number be an integer?
1425
+ * @defaultValue `false`
1426
+ */
1427
+ integer?: boolean | undefined;
1428
+
1429
+ /**
1430
+ * Must the number be positive?
1431
+ * @defaultValue `false`
1432
+ */
1433
+ positive?: boolean | undefined;
1434
+
1435
+ /**
1436
+ * An array of values or an object of values/labels which represent
1437
+ * allowed choices for the field. A function may be provided which dynamically
1438
+ * returns the array of choices.
1439
+ * @defaultValue `undefined`
1440
+ */
1441
+ choices?: NumberField.Choices | undefined;
1442
+ }
1443
+
1444
+ /** The type of the default options for the {@link NumberField | `NumberField`} class when choices are provided. */
1174
1445
  type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false }>;
1175
1446
 
1176
1447
  /**
1177
1448
  * A helper type for the given options type merged into the default options of the NumberField class.
1178
1449
  * @typeParam Options - the options that override the default options
1179
1450
  */
1180
- type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<
1451
+ type MergedOptions<Options extends NumberField.Options> = SimpleMerge<
1181
1452
  undefined extends Options["choices"] ? DefaultOptions : DefaultOptionsWhenChoicesProvided,
1182
1453
  Options
1183
1454
  >;
@@ -1186,7 +1457,7 @@ declare namespace NumberField {
1186
1457
  * A shorthand for the assignment type of a NumberField class.
1187
1458
  * @typeParam Options - the options that override the default options
1188
1459
  */
1189
- type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
1460
+ type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
1190
1461
  number,
1191
1462
  MergedOptions<Options>
1192
1463
  >;
@@ -1195,7 +1466,7 @@ declare namespace NumberField {
1195
1466
  * A shorthand for the initialized type of a NumberField class.
1196
1467
  * @typeParam Options - the options that override the default options
1197
1468
  */
1198
- type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
1469
+ type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
1199
1470
  number,
1200
1471
  MergedOptions<Options>
1201
1472
  >;
@@ -1219,77 +1490,52 @@ declare namespace NumberField {
1219
1490
  type ToInputConfigWithChoices<InitializedType, Choices extends NumberField.Choices | undefined> = SimpleMerge<
1220
1491
  DataField.ToInputConfigWithChoices<InitializedType, Choices>,
1221
1492
  _ToInputConfig<InitializedType>
1222
- >;
1223
-
1224
- interface ToInputConfigWithOptions<InitializedType>
1225
- extends DataField.ToInputConfigWithOptions<InitializedType>,
1226
- _ToInputConfig<InitializedType> {}
1227
-
1228
- type ToInputConfig<InitializedType, Choices extends NumberField.Choices | undefined> =
1229
- | _ToInputConfig<InitializedType>
1230
- | ToInputConfigWithChoices<InitializedType, Choices>
1231
- | ToInputConfigWithOptions<InitializedType>;
1232
- }
1233
-
1234
- declare global {
1235
- interface StringFieldOptions extends DataFieldOptions<string> {
1236
- /**
1237
- * Is the string allowed to be blank (empty)?
1238
- * @defaultValue `true`
1239
- */
1240
- blank?: boolean | undefined;
1241
-
1242
- /**
1243
- * Should any provided string be trimmed as part of cleaning?
1244
- * @defaultValue `true`
1245
- */
1246
- trim?: boolean | undefined;
1247
-
1248
- /**
1249
- * An array of values or an object of values/labels which represent
1250
- * allowed choices for the field. A function may be provided which dynamically
1251
- * returns the array of choices.
1252
- * @defaultValue `undefined`
1253
- */
1254
- choices?: StringField.Choices | undefined;
1493
+ >;
1255
1494
 
1256
- /**
1257
- * @defaultValue `false`
1258
- */
1259
- textSearch?: boolean | undefined;
1260
- }
1495
+ interface ToInputConfigWithOptions<InitializedType>
1496
+ extends DataField.ToInputConfigWithOptions<InitializedType>,
1497
+ _ToInputConfig<InitializedType> {}
1498
+
1499
+ type ToInputConfig<InitializedType, Choices extends NumberField.Choices | undefined> =
1500
+ | _ToInputConfig<InitializedType>
1501
+ | ToInputConfigWithChoices<InitializedType, Choices>
1502
+ | ToInputConfigWithOptions<InitializedType>;
1261
1503
  }
1262
1504
 
1263
1505
  /**
1264
- * A subclass of [DataField]{@link DataField} which deals with string-typed data.
1506
+ * A subclass of {@link DataField | `DataField`} which deals with string-typed data.
1265
1507
  * @typeParam Options - the options of the StringField instance
1266
1508
  * @typeParam AssignmentType - the type of the allowed assignment values of the StringField
1267
1509
  * @typeParam InitializedType - the type of the initialized values of the StringField
1268
1510
  * @typeParam PersistedType - the type of the persisted values of the StringField
1269
1511
  * @remarks
1270
1512
  * Defaults:
1271
- * AssignmentType: `string | null | undefined`
1272
- * InitializedType: `string`
1273
- * PersistedType: `string`
1274
- * InitialValue: `""`
1513
+ * - AssignmentType: `string | null | undefined`
1514
+ * - InitializedType: `string`
1515
+ * - PersistedType: `string`
1516
+ * - InitialValue: `""`
1275
1517
  */
1276
1518
  declare class StringField<
1277
- const Options extends StringFieldOptions = StringField.DefaultOptions,
1519
+ const Options extends StringField.Options<unknown> = StringField.DefaultOptions,
1278
1520
  const AssignmentType = StringField.AssignmentType<Options>,
1279
1521
  const InitializedType = StringField.InitializedType<Options>,
1280
1522
  const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
1281
1523
  > extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
1282
1524
  /**
1283
1525
  * @param options - Options which configure the behavior of the field
1526
+ * @param context - Additional context which describes the field
1527
+ * @remarks If passed `choices`, changes the defaults of `nullable` and `blank`
1284
1528
  */
1285
- constructor(options?: Options, context?: DataField.Context);
1529
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
1530
+ constructor(options?: Options, context?: DataField.ConstructionContext);
1286
1531
 
1287
1532
  /** @defaultValue `undefined` */
1288
- override initial: DataFieldOptions.InitialType<InitializedType>;
1533
+ override initial: DataField.Options.InitialType<InitializedType>;
1289
1534
 
1290
1535
  /**
1291
1536
  * Is the string allowed to be blank (empty)?
1292
1537
  * @defaultValue `true`
1538
+ * @remarks If this field is created with `choices`, the default changes to `false`
1293
1539
  */
1294
1540
  blank: boolean;
1295
1541
 
@@ -1299,7 +1545,10 @@ declare class StringField<
1299
1545
  */
1300
1546
  trim: boolean;
1301
1547
 
1302
- /** @defaultValue `false` */
1548
+ /**
1549
+ * @defaultValue `false`
1550
+ * @remarks If this field is created with `choices`, the default changes to `false`
1551
+ */
1303
1552
  override nullable: boolean;
1304
1553
 
1305
1554
  /**
@@ -1313,28 +1562,33 @@ declare class StringField<
1313
1562
  /** @defaultValue `false` */
1314
1563
  textSearch: boolean;
1315
1564
 
1316
- protected static override get _defaults(): StringFieldOptions;
1565
+ protected static override get _defaults(): StringField.Options<unknown>;
1317
1566
 
1567
+ // options: not null (parameter default only, property access)
1318
1568
  override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
1319
1569
 
1320
1570
  protected override _cast(value: AssignmentType): InitializedType;
1321
1571
 
1322
1572
  protected override _validateSpecial(value: AssignmentType): boolean | void;
1323
1573
 
1574
+ /** @remarks `options` is unused in `StringField` */
1324
1575
  protected override _validateType(
1325
1576
  value: InitializedType,
1326
- options?: DataField.ValidationOptions<DataField.Any>,
1577
+ options?: DataField.ValidateOptions<this>,
1327
1578
  ): boolean | DataModelValidationFailure | void;
1328
1579
 
1329
1580
  /**
1330
1581
  * Test whether a provided value is a valid choice from the allowed choice set
1331
1582
  * @param value - The provided value
1332
1583
  * @returns Is the choice valid?
1584
+ *
1585
+ * @privateRemarks `#_validateType` throws if `value` is not `string` before forwarding here
1333
1586
  */
1334
- protected _isValidChoice(value: AssignmentType): boolean;
1587
+ protected _isValidChoice(value: string): boolean;
1335
1588
 
1336
1589
  /**
1337
1590
  * Get a record of eligible choices for the field.
1591
+ * @remarks Foundry marked `@internal`
1338
1592
  */
1339
1593
  static _getChoices(options?: StringField.GetChoicesOptions): FormSelectOption[];
1340
1594
 
@@ -1364,7 +1618,7 @@ declare class StringField<
1364
1618
  }
1365
1619
 
1366
1620
  declare namespace StringField {
1367
- /** The type of the default options for the {@link StringField} class. */
1621
+ /** The type of the default options for the {@link StringField | `StringField`} class. */
1368
1622
  type DefaultOptions = SimpleMerge<
1369
1623
  DataField.DefaultOptions,
1370
1624
  {
@@ -1376,28 +1630,55 @@ declare namespace StringField {
1376
1630
  }
1377
1631
  >;
1378
1632
 
1379
- /** The type of the default options for the {@link StringField} class when choices are provided. */
1633
+ interface Options<Type = string> extends DataField.Options<Type> {
1634
+ /**
1635
+ * Is the string allowed to be blank (empty)?
1636
+ * @defaultValue `true`
1637
+ */
1638
+ blank?: boolean | undefined;
1639
+
1640
+ /**
1641
+ * Should any provided string be trimmed as part of cleaning?
1642
+ * @defaultValue `true`
1643
+ */
1644
+ trim?: boolean | undefined;
1645
+
1646
+ /**
1647
+ * An array of values or an object of values/labels which represent
1648
+ * allowed choices for the field. A function may be provided which dynamically
1649
+ * returns the array of choices.
1650
+ * @defaultValue `undefined`
1651
+ */
1652
+ choices?: StringField.Choices | undefined;
1653
+
1654
+ /**
1655
+ * @defaultValue `false`
1656
+ */
1657
+ textSearch?: boolean | undefined;
1658
+ }
1659
+
1660
+ /** The type of the default options for the {@link StringField | `StringField`} class when choices are provided. */
1380
1661
  type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false; blank: false }>;
1381
1662
 
1382
1663
  /**
1383
1664
  * A helper type for the given options type merged into the default options of the StringField class.
1384
1665
  * @typeParam Options - the options that override the default options
1385
1666
  */
1386
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<
1667
+ type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<
1387
1668
  _OptionsForInitial<_OptionsForChoices<Options["choices"]>>,
1388
1669
  Options
1389
1670
  >;
1390
1671
 
1391
- type _OptionsForChoices<Choices extends StringFieldOptions["choices"]> = undefined extends Choices
1672
+ type _OptionsForChoices<Choices extends StringField.Options["choices"]> = undefined extends Choices
1392
1673
  ? DefaultOptions
1393
1674
  : DefaultOptionsWhenChoicesProvided;
1394
1675
 
1395
1676
  // FIXME: `"initial" extends keyof Options` does not work for modeling `"initial" in options`.
1396
- type _OptionsForInitial<Options extends StringFieldOptions> = "initial" extends keyof Options
1677
+ type _OptionsForInitial<Options extends StringField.Options<unknown>> = "initial" extends keyof Options
1397
1678
  ? Options
1398
1679
  : SimpleMerge<Options, { initial: _InitialForOptions<Options> }>;
1399
1680
 
1400
- type _InitialForOptions<Options extends StringFieldOptions> = Options["required"] extends false | undefined
1681
+ type _InitialForOptions<Options extends StringField.Options<unknown>> = Options["required"] extends false | undefined
1401
1682
  ? undefined
1402
1683
  : Options["blank"] extends true
1403
1684
  ? string
@@ -1407,19 +1688,24 @@ declare namespace StringField {
1407
1688
 
1408
1689
  // choices?: string[] | Record<string, string> | (() => string[] | Record<string, string>) | undefined;
1409
1690
 
1410
- type ValidChoice<Options extends StringFieldOptions> = Options["choices"] extends undefined
1691
+ type ValidChoice<Options extends StringField.Options<unknown>> = Options["choices"] extends undefined
1411
1692
  ? string
1412
- : Options["choices"] extends (...args: any) => infer Choices
1693
+ : Options["choices"] extends (...args: infer _1) => infer Choices
1413
1694
  ? FixedChoice<Choices>
1414
1695
  : FixedChoice<Options["choices"]>;
1415
1696
 
1416
- type FixedChoice<Choices> = Choices extends Array<infer U> ? U : Choices extends Record<infer K, any> ? K : string;
1697
+ type FixedChoice<Choices> =
1698
+ Choices extends ReadonlyArray<infer U>
1699
+ ? U
1700
+ : Choices extends { readonly [_ in infer K]: infer _1 }
1701
+ ? K & string
1702
+ : string;
1417
1703
 
1418
1704
  /**
1419
1705
  * A shorthand for the assignment type of a StringField class.
1420
1706
  * @typeParam Options - the options that override the default options
1421
1707
  */
1422
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
1708
+ type AssignmentType<Options extends StringField.Options<unknown>> = DataField.DerivedAssignmentType<
1423
1709
  ValidChoice<Options>,
1424
1710
  MergedOptions<Options>
1425
1711
  >;
@@ -1428,7 +1714,7 @@ declare namespace StringField {
1428
1714
  * A shorthand for the initialized type of a StringField class.
1429
1715
  * @typeParam Options - the options that override the default options
1430
1716
  */
1431
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
1717
+ type InitializedType<Options extends StringField.Options<unknown>> = DataField.DerivedInitializedType<
1432
1718
  // TODO(LukeAbby): This is a workaround for how `ValidChoice` is defined ignorant of the `StringField`/`NumberField` divide.
1433
1719
  ValidChoice<Options> & (string | null | undefined),
1434
1720
  MergedOptions<Options>
@@ -1440,11 +1726,10 @@ declare namespace StringField {
1440
1726
  }
1441
1727
  | readonly string[];
1442
1728
 
1729
+ // TODO: consolidate with inline type in GetChoicesOptions if possible
1443
1730
  type Choices = BaseChoices | (() => BaseChoices);
1444
1731
 
1445
- /**
1446
- * @internal
1447
- */
1732
+ /** @internal */
1448
1733
  interface _GetChoicesOptions {
1449
1734
  /**
1450
1735
  * The property in the choice object values to use as the option label.
@@ -1470,20 +1755,20 @@ declare namespace StringField {
1470
1755
  }
1471
1756
 
1472
1757
  /**
1473
- * A subclass of [DataField]{@link DataField} which deals with object-typed data.
1758
+ * A subclass of {@link DataField | `DataField`} which deals with object-typed data.
1474
1759
  * @typeParam Options - the options of the ObjectField instance
1475
1760
  * @typeParam AssignmentType - the type of the allowed assignment values of the ObjectField
1476
1761
  * @typeParam InitializedType - the type of the initialized values of the ObjectField
1477
1762
  * @typeParam PersistedType - the type of the persisted values of the ObjectField
1478
1763
  * @remarks
1479
1764
  * Defaults:
1480
- * AssignmentType: `object | null | undefined`
1481
- * InitializedType: `object`
1482
- * PersistedType: `object`
1483
- * InitialValue: `{}`
1765
+ * - AssignmentType: `object | null | undefined`
1766
+ * - InitializedType: `object`
1767
+ * - PersistedType: `object`
1768
+ * - InitialValue: `{}`
1484
1769
  */
1485
1770
  declare class ObjectField<
1486
- const Options extends DataFieldOptions<AnyObject> = ObjectField.DefaultOptions,
1771
+ const Options extends DataField.Options<AnyObject> = ObjectField.DefaultOptions,
1487
1772
  const AssignmentType = ObjectField.AssignmentType<Options>,
1488
1773
  const InitializedType = ObjectField.InitializedType<Options>,
1489
1774
  const PersistedType extends AnyObject | null | undefined = ObjectField.InitializedType<Options>,
@@ -1495,28 +1780,33 @@ declare class ObjectField<
1495
1780
  override nullable: boolean;
1496
1781
 
1497
1782
  /** @defaultValue `() => ({})` */
1498
- override initial: DataFieldOptions.InitialType<InitializedType>;
1783
+ override initial: DataField.Options.InitialType<InitializedType>;
1499
1784
 
1500
- protected static override get _defaults(): DataFieldOptions<AnyObject>;
1785
+ protected static override get _defaults(): DataField.Options<AnyObject>;
1786
+
1787
+ override getInitialValue(data?: unknown): InitializedType;
1501
1788
 
1502
1789
  protected override _cast(value: AssignmentType): InitializedType;
1503
1790
 
1791
+ // options: not null (parameter default only)
1504
1792
  override initialize(
1505
1793
  value: PersistedType,
1506
1794
  model: DataModel.Any,
1507
- options?: AnyObject,
1795
+ options?: DataField.InitializeOptions,
1508
1796
  ): InitializedType | (() => InitializedType | null);
1509
1797
 
1510
1798
  override toObject(value: InitializedType): PersistedType;
1511
1799
 
1800
+ /** @remarks `options` is unused in `ObjectField` */
1801
+ // options: not null (parameter default only, despite being unused)
1512
1802
  protected override _validateType(
1513
1803
  value: InitializedType,
1514
- options?: DataField.ValidationOptions<DataField.Any>,
1804
+ options?: DataField.ValidateOptions<this>,
1515
1805
  ): boolean | DataModelValidationFailure | void;
1516
1806
  }
1517
1807
 
1518
1808
  declare namespace ObjectField {
1519
- /** The type of the default options for the {@link ObjectField} class. */
1809
+ /** The type of the default options for the {@link ObjectField | `ObjectField`} class. */
1520
1810
  type DefaultOptions = SimpleMerge<
1521
1811
  DataField.DefaultOptions,
1522
1812
  {
@@ -1529,13 +1819,13 @@ declare namespace ObjectField {
1529
1819
  * A helper type for the given options type merged into the default options of the ObjectField class.
1530
1820
  * @typeParam Options - the options that override the default options
1531
1821
  */
1532
- type MergedOptions<Options extends DataFieldOptions<AnyObject>> = SimpleMerge<DefaultOptions, Options>;
1822
+ type MergedOptions<Options extends DataField.Options<AnyObject>> = SimpleMerge<DefaultOptions, Options>;
1533
1823
 
1534
1824
  /**
1535
1825
  * A shorthand for the assignment type of a ObjectField class.
1536
1826
  * @typeParam Options - the options that override the default options
1537
1827
  */
1538
- type AssignmentType<Options extends DataFieldOptions<AnyObject>> = DataField.DerivedAssignmentType<
1828
+ type AssignmentType<Options extends DataField.Options<AnyObject>> = DataField.DerivedAssignmentType<
1539
1829
  AnyObject,
1540
1830
  MergedOptions<Options>
1541
1831
  >;
@@ -1544,13 +1834,13 @@ declare namespace ObjectField {
1544
1834
  * A shorthand for the initialized type of a ObjectField class.
1545
1835
  * @typeParam Options - the options that override the default options
1546
1836
  */
1547
- type InitializedType<Options extends DataFieldOptions<AnyObject>> = DataField.DerivedInitializedType<
1837
+ type InitializedType<Options extends DataField.Options<AnyObject>> = DataField.DerivedInitializedType<
1548
1838
  AnyObject,
1549
1839
  MergedOptions<Options>
1550
1840
  >;
1551
1841
 
1552
1842
  /**
1553
- * A helper to create a flags object field for the given key in the {@link FlagConfig}.
1843
+ * A helper to create a flags object field for the given key in the {@link FlagConfig | `FlagConfig`}.
1554
1844
  * @typeParam Key - the key to look for in the FlagConfig
1555
1845
  * @typeParam ExtensionFlags - additional flags besides the ones configured for the class
1556
1846
  * @typeParam Options - the options of the field
@@ -1560,17 +1850,26 @@ declare namespace ObjectField {
1560
1850
  // The type `{}` is useful here because in an intersection it reduces down to nothing unlike `EmptyObject`.
1561
1851
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1562
1852
  ExtensionFlags extends AnyObject = {},
1563
- Options extends DataFieldOptions.Any = ObjectField.DefaultOptions,
1853
+ Options extends DataField.Options.Any = ObjectField.DefaultOptions,
1564
1854
  > = ObjectField<
1565
1855
  Options,
1566
- DataField.DerivedAssignmentType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>,
1567
- DataField.DerivedInitializedType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>,
1568
- DataField.DerivedInitializedType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>
1856
+ DataField.DerivedAssignmentType<
1857
+ Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
1858
+ MergedOptions<Options>
1859
+ >,
1860
+ DataField.DerivedInitializedType<
1861
+ Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
1862
+ MergedOptions<Options>
1863
+ >,
1864
+ DataField.DerivedInitializedType<
1865
+ Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
1866
+ MergedOptions<Options>
1867
+ >
1569
1868
  >;
1570
1869
  }
1571
1870
 
1572
1871
  /**
1573
- * A subclass of [DataField]{@link DataField} which deals with array-typed data.
1872
+ * A subclass of {@link DataField | `DataField`} which deals with array-typed data.
1574
1873
  * @typeParam ElementFieldType - the field type for the elements in the ArrayField
1575
1874
  * @typeParam AssignmentElementType - the assignment type for the elements in the array
1576
1875
  * @typeParam InitializedElementType - the initialized type for the elements in the array
@@ -1580,11 +1879,14 @@ declare namespace ObjectField {
1580
1879
  * @typeParam PersistedElementType - the persisted type for the elements in the array
1581
1880
  * @typeParam PersistedType - the type of the persisted values of the ArrayField
1582
1881
  * @remarks
1882
+ * `ArrayField` itself will not accept Document class instances, that exists on `ElementFieldType` to support
1883
+ * {@link EmbeddedCollectionField | `EmbeddedCollectionField` }
1884
+ *
1583
1885
  * Defaults:
1584
- * AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
1585
- * InitializedType: `InitializedElementType[]`
1586
- * PersistedType: `PersistedElementType[]`
1587
- * InitialValue: `[]`
1886
+ * - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
1887
+ * - InitializedType: `InitializedElementType[]`
1888
+ * - PersistedType: `PersistedElementType[]`
1889
+ * - InitialValue: `[]`
1588
1890
  */
1589
1891
  declare class ArrayField<
1590
1892
  const ElementFieldType extends DataField.Any | Document.AnyConstructor,
@@ -1605,8 +1907,11 @@ declare class ArrayField<
1605
1907
  /**
1606
1908
  * @param element - A DataField instance which defines the type of element contained in the Array.
1607
1909
  * @param options - Options which configure the behavior of the field
1910
+ * @param context - Additional context which describes the field
1911
+ * @throws If provided a `max` that is lower than `min` (default `0`)
1608
1912
  */
1609
- constructor(element: ElementFieldType, options?: Options, context?: DataField.Context);
1913
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
1914
+ constructor(element: ElementFieldType, options?: Options, context?: DataField.ConstructionContext);
1610
1915
 
1611
1916
  /** @defaultValue `true` */
1612
1917
  override required: boolean;
@@ -1615,7 +1920,7 @@ declare class ArrayField<
1615
1920
  override nullable: boolean;
1616
1921
 
1617
1922
  /** @defaultValue `() => []` */
1618
- override initial: DataFieldOptions.InitialType<InitializedType>;
1923
+ override initial: DataField.Options.InitialType<InitializedType>;
1619
1924
 
1620
1925
  /**
1621
1926
  * The data type of each element in this array
@@ -1637,15 +1942,21 @@ declare class ArrayField<
1637
1942
  */
1638
1943
  protected static _validateElementType<T extends DataField.Any>(element: T): T;
1639
1944
 
1640
- protected override _validateModel(data: AnyObject, options?: AnyObject): void;
1945
+ // options: not null (could be destructured in element#_validateModel)
1946
+ protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
1641
1947
 
1642
1948
  protected override _cast(value: AssignmentType): InitializedType;
1643
1949
 
1644
- protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
1950
+ /**
1951
+ * @remarks `options` gets its `partial` property forced `false`, then each element gets run through its field's `#clean`
1952
+ * @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
1953
+ */
1954
+ protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
1645
1955
 
1956
+ // options: not null (parameter default only)
1646
1957
  protected override _validateType(
1647
1958
  value: InitializedType,
1648
- options?: DataField.ValidationOptions<DataField.Any>,
1959
+ options?: DataField.ValidateOptions<this>,
1649
1960
  ): boolean | DataModelValidationFailure | void;
1650
1961
 
1651
1962
  /**
@@ -1655,8 +1966,8 @@ declare class ArrayField<
1655
1966
  * @returns An array of element-specific errors
1656
1967
  */
1657
1968
  protected _validateElements(
1658
- value: any[],
1659
- options?: DataField.ValidationOptions<DataField.Any>,
1969
+ value: AnyArray,
1970
+ options?: DataField.ValidateOptions<this> | null,
1660
1971
  ): DataModelValidationFailure | void;
1661
1972
 
1662
1973
  /**
@@ -1666,26 +1977,28 @@ declare class ArrayField<
1666
1977
  * @returns A validation failure if the element failed validation
1667
1978
  */
1668
1979
  protected _validateElement(
1669
- value: any,
1670
- options: DataField.ValidationOptions<DataField.Any>,
1980
+ value: unknown,
1981
+ options: DataField.ValidateOptions<this>,
1671
1982
  ): DataModelValidationFailure | void;
1672
1983
 
1984
+ // options: not null (parameter default only)
1673
1985
  override initialize(
1674
1986
  value: PersistedType,
1675
1987
  model: DataModel.Any,
1676
- options?: AnyObject,
1988
+ options?: DataField.InitializeOptions,
1677
1989
  ): InitializedType | (() => InitializedType | null);
1678
1990
 
1679
1991
  override toObject(value: InitializedType): PersistedType;
1680
1992
 
1681
1993
  // TODO: Limit to the keys of `this` that are actually callable.
1682
- override apply<Value, Options, Return>(
1683
- fn: keyof this | ((this: this, value: Value, options: Options) => Return),
1684
- value: Value,
1994
+ // options: not null (could be forwarded somewhere destructured, parameter default only)
1995
+ override apply<Options, Return>(
1996
+ fn: keyof this | ((this: this, value: AnyArray, options: Options) => Return),
1997
+ value?: AnyArray,
1685
1998
  options?: Options,
1686
1999
  ): Return;
1687
2000
 
1688
- protected override _getField(path: string[]): unknown;
2001
+ protected override _getField(path: string[]): DataField.Any;
1689
2002
 
1690
2003
  /**
1691
2004
  * Migrate this field's candidate source data.
@@ -1693,6 +2006,16 @@ declare class ArrayField<
1693
2006
  * @param fieldData - The value of this field within the source data
1694
2007
  */
1695
2008
  migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
2009
+
2010
+ protected override _castChangeDelta(delta: string): InitializedType;
2011
+
2012
+ /** @remarks Returns `value` with `delta` `push`ed. `model` and `change` are unused in `ArrayField` */
2013
+ protected override _applyChangeAdd(
2014
+ value: InitializedType,
2015
+ delta: InitializedType,
2016
+ model: DataModel.Any,
2017
+ change: ActiveEffect.EffectChangeData,
2018
+ ): InitializedType;
1696
2019
  }
1697
2020
 
1698
2021
  declare namespace ArrayField {
@@ -1700,12 +2023,12 @@ declare namespace ArrayField {
1700
2023
  * A shorthand for the options of an ArrayField class.
1701
2024
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1702
2025
  */
1703
- type Options<AssignmentElementType> = DataFieldOptions<BaseAssignmentType<AssignmentElementType>>;
2026
+ type Options<AssignmentElementType> = DataField.Options<BaseAssignmentType<AssignmentElementType>>;
1704
2027
 
1705
2028
  type AnyOptions = Options<unknown>;
1706
2029
 
1707
2030
  /**
1708
- * The base assignment type for the {@link ArrayField} class.
2031
+ * The base assignment type for the {@link ArrayField | `ArrayField`} class.
1709
2032
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1710
2033
  */
1711
2034
  type BaseAssignmentType<AssignmentElementType> =
@@ -1715,7 +2038,7 @@ declare namespace ArrayField {
1715
2038
  | AssignmentElementType;
1716
2039
 
1717
2040
  /**
1718
- * The type of the default options for the {@link ArrayField} class.
2041
+ * The type of the default options for the {@link ArrayField | `ArrayField`} class.
1719
2042
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1720
2043
  */
1721
2044
  type DefaultOptions<AssignmentElementType> = SimpleMerge<
@@ -1742,33 +2065,33 @@ declare namespace ArrayField {
1742
2065
  * @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
1743
2066
  */
1744
2067
  type AssignmentElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
1745
- ElementFieldType extends DataField<any, infer Assign, any, any>
1746
- ? Assign
1747
- : ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
1748
- ? SchemaField.InnerAssignmentType<Schema>
1749
- : never;
2068
+ ElementFieldType extends
2069
+ | (abstract new (...args: infer _1) => { " __fvtt_types_internal_assignment_data": infer AssignmentData })
2070
+ | { " __fvtt_types_internal_assignment_data": infer AssignmentData }
2071
+ ? AssignmentData
2072
+ : never;
1750
2073
 
1751
2074
  /**
1752
2075
  * A type to infer the initialized element type of an ArrayField from its ElementFieldType.
1753
2076
  * @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
1754
2077
  */
1755
2078
  type InitializedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
1756
- ElementFieldType extends DataField<any, any, infer Init, any>
1757
- ? Init
1758
- : ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
1759
- ? SchemaField.InnerInitializedType<Schema>
1760
- : never;
2079
+ ElementFieldType extends
2080
+ | (abstract new (...args: infer _1) => { " __fvtt_types_internal_initialized_data": infer InitializedData })
2081
+ | { " __fvtt_types_internal_initialized_data": infer InitializedData }
2082
+ ? InitializedData
2083
+ : never;
1761
2084
 
1762
2085
  /**
1763
2086
  * A type to infer the initialized element type of an ArrayField from its ElementFieldType.
1764
2087
  * @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
1765
2088
  */
1766
2089
  type PersistedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
1767
- ElementFieldType extends DataField<any, any, any, infer Persist>
1768
- ? Persist
1769
- : ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
1770
- ? SchemaField.InnerPersistedType<Schema>
1771
- : never;
2090
+ ElementFieldType extends
2091
+ | (abstract new (...args: infer _1) => { " __fvtt_types_internal_source_data": infer PersistedData })
2092
+ | { " __fvtt_types_internal_source_data": infer PersistedData }
2093
+ ? PersistedData
2094
+ : never;
1772
2095
 
1773
2096
  /**
1774
2097
  * A shorthand for the assignment type of an ArrayField class.
@@ -1795,7 +2118,7 @@ declare namespace ArrayField {
1795
2118
  /**
1796
2119
  * A shorthand for the persisted type of an ArrayField class.
1797
2120
  * @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
1798
- * @typeParam PersistedElementType - the perssited type of the elements of the ArrayField
2121
+ * @typeParam PersistedElementType - the persisted type of the elements of the ArrayField
1799
2122
  * @typeParam Opts - the options that override the default options
1800
2123
  */
1801
2124
  type PersistedType<
@@ -1806,7 +2129,7 @@ declare namespace ArrayField {
1806
2129
  }
1807
2130
 
1808
2131
  /**
1809
- * A subclass of [ArrayField]{@link ArrayField} which supports a set of contained elements.
2132
+ * A subclass of {@link ArrayField | `ArrayField`} which supports a set of contained elements.
1810
2133
  * Elements in this set are treated as fungible and may be represented in any order or discarded if invalid.
1811
2134
  * @typeParam ElementFieldType - the field type for the elements in the SetField
1812
2135
  * @typeParam AssignmentElementType - the assignment type for the elements in the set
@@ -1818,10 +2141,10 @@ declare namespace ArrayField {
1818
2141
  * @typeParam PersistedType - the type of the persisted values of the SetField
1819
2142
  * @remarks
1820
2143
  * Defaults:
1821
- * AssignmentType: `SetField.BaseAssignmentType<AssignmentElementType> | null | undefined`
1822
- * InitializedType: `Set<InitializedElementType>`
1823
- * PersistedType: `PersistedElementType[]`
1824
- * InitialValue: `new Set()`
2144
+ * - AssignmentType: `SetField.BaseAssignmentType<AssignmentElementType> | null | undefined`
2145
+ * - InitializedType: `Set<InitializedElementType>`
2146
+ * - PersistedType: `PersistedElementType[]`
2147
+ * - InitialValue: `new Set()`
1825
2148
  */
1826
2149
  declare class SetField<
1827
2150
  ElementFieldType extends DataField.Any,
@@ -1846,15 +2169,17 @@ declare class SetField<
1846
2169
  PersistedElementType,
1847
2170
  PersistedType
1848
2171
  > {
2172
+ // options: required (property access with no default)
1849
2173
  protected override _validateElements(
1850
2174
  value: any[],
1851
- options?: DataField.ValidationOptions<DataField.Any>,
2175
+ options: DataField.ValidateOptions<this>,
1852
2176
  ): void | DataModelValidationFailure;
1853
2177
 
2178
+ // options: not null (parameter default only)
1854
2179
  override initialize(
1855
2180
  value: PersistedType,
1856
2181
  model: DataModel.Any,
1857
- options?: AnyObject,
2182
+ options?: DataField.InitializeOptions,
1858
2183
  ): InitializedType | (() => InitializedType | null);
1859
2184
 
1860
2185
  override toObject(value: InitializedType): PersistedType;
@@ -1869,28 +2194,41 @@ declare class SetField<
1869
2194
  protected override _toInput(
1870
2195
  config: SetField.ToInputConfig<ElementFieldType, InitializedType>,
1871
2196
  ): HTMLElement | HTMLCollection;
2197
+
2198
+ protected override _castChangeDelta(delta: string): InitializedType;
2199
+
2200
+ /**
2201
+ * @remarks Returns `value` with each element of `delta` `add`ed in order.
2202
+ * `model` and `change` are unused in `SetField`
2203
+ */
2204
+ protected override _applyChangeAdd(
2205
+ value: InitializedType,
2206
+ delta: InitializedType,
2207
+ model: DataModel.Any,
2208
+ change: ActiveEffect.EffectChangeData,
2209
+ ): InitializedType;
1872
2210
  }
1873
2211
 
1874
2212
  declare namespace SetField {
1875
2213
  /** Any SetField */
1876
- type Any = SetField<DataField.Any, any, any, any, any, any, any, any>;
2214
+ interface Any extends SetField<DataField.Any, any, any, any, any, any, any, any> {}
1877
2215
 
1878
2216
  /**
1879
2217
  * A shorthand for the options of a SetField class.
1880
2218
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1881
2219
  */
1882
- type Options<AssignmentElementType> = DataFieldOptions<SetField.BaseAssignmentType<AssignmentElementType>>;
2220
+ type Options<AssignmentElementType> = DataField.Options<SetField.BaseAssignmentType<AssignmentElementType>>;
1883
2221
 
1884
2222
  type AnyOptions = Options<unknown>;
1885
2223
 
1886
2224
  /**
1887
- * The base assignment type for the {@link SetField} class.
2225
+ * The base assignment type for the {@link SetField | `SetField`} class.
1888
2226
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1889
2227
  */
1890
2228
  type BaseAssignmentType<AssignmentElementType> = ArrayField.BaseAssignmentType<AssignmentElementType>;
1891
2229
 
1892
2230
  /**
1893
- * The type of the default options for the {@link SetField} class.
2231
+ * The type of the default options for the {@link SetField | `SetField`} class.
1894
2232
  * @typeParam AssignmentElementType - the assignment type of the elements in the array
1895
2233
  */
1896
2234
  type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
@@ -1930,7 +2268,7 @@ declare namespace SetField {
1930
2268
  /**
1931
2269
  * A shorthand for the persisted type of a SetField class.
1932
2270
  * @typeParam AssignmentElementType - the assignment type of the elements of the SetField
1933
- * @typeParam PersistedElementType - the perssited type of the elements of the SetField
2271
+ * @typeParam PersistedElementType - the persisted type of the elements of the SetField
1934
2272
  * @typeParam Opts - the options that override the default options
1935
2273
  */
1936
2274
  type PersistedType<
@@ -1949,7 +2287,7 @@ declare namespace SetField {
1949
2287
  }
1950
2288
 
1951
2289
  /**
1952
- * A subclass of [ObjectField]{@link ObjectField} which embeds some other DataModel definition as an inner object.
2290
+ * A subclass of {@link ObjectField | `ObjectField`} which embeds some other DataModel definition as an inner object.
1953
2291
  * @typeParam ModelType - the DataModel for the embedded data
1954
2292
  * @typeParam Options - the options of the EmbeddedDataField instance
1955
2293
  * @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDataField
@@ -1957,10 +2295,10 @@ declare namespace SetField {
1957
2295
  * @typeParam PersistedType - the type of the persisted values of the EmbeddedDataField
1958
2296
  * @remarks
1959
2297
  * Defaults:
1960
- * AssignmentType: `SchemaField.AssignmentType<ModelType["schema"]["fields"]> | null | undefined`
1961
- * InitializedType: `SchemaField.InitializedType<ModelType["schema"]["fields"]>`
1962
- * PersistedType: `SchemaField.PersistedType<ModelType["schema"]["fields"]>`
1963
- * InitialValue: `{}`
2298
+ * - AssignmentType: `SchemaField.AssignmentType<ModelType["schema"]["fields"]> | null | undefined`
2299
+ * - InitializedType: `SchemaField.InitializedType<ModelType["schema"]["fields"]>`
2300
+ * - PersistedType: `SchemaField.PersistedType<ModelType["schema"]["fields"]>`
2301
+ * - InitialValue: `{}`
1964
2302
  */
1965
2303
  declare class EmbeddedDataField<
1966
2304
  const ModelType extends DataModel.AnyConstructor,
@@ -1972,20 +2310,32 @@ declare class EmbeddedDataField<
1972
2310
  /**
1973
2311
  * @param model - The class of DataModel which should be embedded in this field
1974
2312
  * @param options - Options which configure the behavior of the field
2313
+ * @param context - Additional context which describes the field
1975
2314
  */
1976
- constructor(model: ModelType, options?: Options, context?: DataField.Context);
2315
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
2316
+ constructor(model: ModelType, options?: Options, context?: DataField.ConstructionContext);
1977
2317
 
1978
2318
  /**
1979
2319
  * The embedded DataModel definition which is contained in this field.
1980
2320
  */
1981
2321
  model: ModelType;
1982
2322
 
1983
- protected override _initialize(fields: DataModel.SchemaOfClass<ModelType>): DataModel.SchemaOfClass<ModelType>;
2323
+ /** @remarks Passed `options.source` will be ignored, forwarded to super with `source: value` */
2324
+ // options: not null (parameter default only, property access)
2325
+ override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
2326
+
2327
+ /** @remarks Forwards to super with `options.source: value` */
2328
+ // options: not null (parameter default only, property access)
2329
+ override validate(
2330
+ value: AssignmentType,
2331
+ options?: DataField.ValidateOptions<this>,
2332
+ ): DataModelValidationFailure | void;
1984
2333
 
2334
+ // options: not null (parameter default only)
1985
2335
  override initialize(
1986
2336
  value: PersistedType,
1987
2337
  model: DataModel.Any,
1988
- options?: AnyObject,
2338
+ options?: DataField.InitializeOptions,
1989
2339
  ): InitializedType | (() => InitializedType | null);
1990
2340
 
1991
2341
  override toObject(value: InitializedType): PersistedType;
@@ -1997,7 +2347,7 @@ declare class EmbeddedDataField<
1997
2347
  */
1998
2348
  migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
1999
2349
 
2000
- protected override _validateModel(data: AnyObject, options?: AnyObject): void;
2350
+ protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions | null): void;
2001
2351
  }
2002
2352
 
2003
2353
  declare namespace EmbeddedDataField {
@@ -2005,11 +2355,11 @@ declare namespace EmbeddedDataField {
2005
2355
  * A shorthand for the options of an EmbeddedDataField class.
2006
2356
  * @typeParam ModelType - the DataModel for the embedded data
2007
2357
  */
2008
- type Options<ModelType extends DataModel.AnyConstructor> = DataFieldOptions<
2009
- SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<ModelType>> | __SchemaFieldInitial
2358
+ type Options<ModelType extends DataModel.AnyConstructor> = DataField.Options<
2359
+ SchemaField.AssignmentData<DataModel.SchemaOfClass<ModelType>> | __SchemaFieldInitial
2010
2360
  >;
2011
2361
 
2012
- /** The type of the default options for the {@link EmbeddedDataField} class. */
2362
+ /** The type of the default options for the {@link EmbeddedDataField | `EmbeddedDataField`} class. */
2013
2363
  type DefaultOptions = SchemaField.DefaultOptions;
2014
2364
 
2015
2365
  /**
@@ -2031,7 +2381,7 @@ declare namespace EmbeddedDataField {
2031
2381
  ModelType extends DataModel.AnyConstructor,
2032
2382
  Opts extends Options<ModelType>,
2033
2383
  > = DataField.DerivedAssignmentType<
2034
- SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<ModelType>>,
2384
+ SchemaField.AssignmentData<DataModel.SchemaOfClass<ModelType>>,
2035
2385
  MergedOptions<ModelType, Opts>
2036
2386
  >;
2037
2387
 
@@ -2044,7 +2394,7 @@ declare namespace EmbeddedDataField {
2044
2394
  type InitializedType<
2045
2395
  ModelType extends DataModel.AnyConstructor,
2046
2396
  Opts extends Options<ModelType>,
2047
- > = DataField.DerivedInitializedType<InstanceType<ModelType>, MergedOptions<ModelType, Opts>>;
2397
+ > = DataField.DerivedInitializedType<FixedInstanceType<ModelType>, MergedOptions<ModelType, Opts>>;
2048
2398
 
2049
2399
  /**
2050
2400
  * A shorthand for the persisted type of an EmbeddedDataField class.
@@ -2055,13 +2405,13 @@ declare namespace EmbeddedDataField {
2055
2405
  ModelType extends DataModel.AnyConstructor,
2056
2406
  Opts extends Options<ModelType>,
2057
2407
  > = DataField.DerivedInitializedType<
2058
- SchemaField.InnerPersistedType<DataModel.SchemaOfClass<ModelType>>,
2408
+ SchemaField.SourceData<DataModel.SchemaOfClass<ModelType>>,
2059
2409
  MergedOptions<ModelType, Opts>
2060
2410
  >;
2061
2411
  }
2062
2412
 
2063
2413
  /**
2064
- * A subclass of [ArrayField]{@link ArrayField} which supports an embedded Document collection.
2414
+ * A subclass of {@link ArrayField | `ArrayField`} which supports an embedded Document collection.
2065
2415
  * Invalid elements will be dropped from the collection during validation rather than failing for the field entirely.
2066
2416
  * @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionField
2067
2417
  * @typeParam AssignmentElementType - the assignment type for the elements in the collection
@@ -2073,10 +2423,10 @@ declare namespace EmbeddedDataField {
2073
2423
  * @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionField
2074
2424
  * @remarks
2075
2425
  * Defaults:
2076
- * AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
2077
- * InitializedType: `Collection<InitializedElementType>`
2078
- * PersistedType: `PersistedElementType[]`
2079
- * InitialValue: `[]`
2426
+ * - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
2427
+ * - InitializedType: `Collection<InitializedElementType>`
2428
+ * - PersistedType: `PersistedElementType[]`
2429
+ * - InitialValue: `[]`
2080
2430
  */
2081
2431
  declare class EmbeddedCollectionField<
2082
2432
  ElementFieldType extends Document.AnyConstructor,
@@ -2113,10 +2463,16 @@ declare class EmbeddedCollectionField<
2113
2463
  /**
2114
2464
  * @param element - The type of Document which belongs to this embedded collection
2115
2465
  * @param options - Options which configure the behavior of the field
2466
+ * @param context - Additional context which describes the field
2467
+ * @remarks Forces `readonly: true`, regardless of passed value
2116
2468
  */
2117
- constructor(element: ElementFieldType, options?: Options, context?: DataField.Context);
2469
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
2470
+ constructor(element: ElementFieldType, options?: Options, context?: DataField.ConstructionContext);
2118
2471
 
2119
- /** @defaultValue `true` */
2472
+ /**
2473
+ * @defaultValue `true`
2474
+ * @remarks Enforced by the constructor
2475
+ */
2120
2476
  override readonly: true;
2121
2477
 
2122
2478
  protected static override _validateElementType<T extends DataField.Any | Document.AnyConstructor>(element: T): T;
@@ -2139,24 +2495,35 @@ declare class EmbeddedCollectionField<
2139
2495
  */
2140
2496
  get schema(): this["model"]["schema"];
2141
2497
 
2142
- protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
2498
+ protected override _cast(value: AssignmentType): InitializedType;
2499
+
2500
+ /**
2501
+ * @remarks Calls the Collection's Document's Implementation's `schema.clean` on every entry in `value`,
2502
+ * with `options.source` set to that entry
2503
+ * @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
2504
+ */
2505
+ protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
2143
2506
 
2507
+ // options: required (property access with no default)
2144
2508
  protected override _validateElements(
2145
2509
  value: any[],
2146
- options?: DataField.ValidationOptions<DataField.Any>,
2510
+ options: DataField.ValidateOptions<this>,
2147
2511
  ): DataModelValidationFailure | void;
2148
2512
 
2513
+ // options: not null (parameter default only)
2149
2514
  override initialize(
2150
2515
  value: PersistedType,
2151
2516
  model: DataModel.Any,
2152
- options?: AnyObject,
2517
+ options?: DataField.InitializeOptions,
2153
2518
  ): InitializedType | (() => InitializedType | null);
2154
2519
 
2155
2520
  override toObject(value: InitializedType): PersistedType;
2156
2521
 
2522
+ // TODO: Find a way to limit `Value` to `AnyObject | undefined` here while allowing it to be `unknown` in DataField
2523
+ // options: not null (could be forwarded somewhere destructured, parameter default only)
2157
2524
  override apply<Value, Options, Return>(
2158
2525
  fn: keyof this | ((this: this, value: Value, options: Options) => Return),
2159
- value: Value,
2526
+ value?: Value,
2160
2527
  options?: Options,
2161
2528
  ): Return;
2162
2529
 
@@ -2175,16 +2542,16 @@ declare class EmbeddedCollectionField<
2175
2542
  }
2176
2543
 
2177
2544
  declare namespace EmbeddedCollectionField {
2178
- type Any = EmbeddedCollectionField<any, any, any, any, any, any, any, any, any>;
2545
+ interface Any extends EmbeddedCollectionField<any, any, any, any, any, any, any, any, any> {}
2179
2546
 
2180
2547
  /**
2181
2548
  * A shorthand for the options of an EmbeddedCollectionField class.
2182
2549
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
2183
2550
  */
2184
- type Options<AssignmentElementType> = DataFieldOptions<ArrayField.BaseAssignmentType<AssignmentElementType>>;
2551
+ type Options<AssignmentElementType> = DataField.Options<ArrayField.BaseAssignmentType<AssignmentElementType>>;
2185
2552
 
2186
2553
  /**
2187
- * The type of the default options for the {@link EmbeddedCollectionField} class.
2554
+ * The type of the default options for the {@link EmbeddedCollectionField | `EmbeddedCollectionField`} class.
2188
2555
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
2189
2556
  */
2190
2557
  type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
@@ -2203,10 +2570,11 @@ declare namespace EmbeddedCollectionField {
2203
2570
  * A type to infer the assignment element type of an EmbeddedCollectionField from its ElementFieldType.
2204
2571
  * @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
2205
2572
  */
2206
- type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
2207
- ...args: any[]
2208
- ) => Document<any, infer Schema extends DataSchema, any>
2209
- ? SchemaField.InnerAssignmentType<Schema>
2573
+ // Note(LukeAbby): For some reason checking `extends Document` causes issues where this doesn't.
2574
+ type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
2575
+ ...args: infer _1
2576
+ ) => { " __fvtt_types_internal_assignment_data": infer AssignmentData }
2577
+ ? AssignmentData
2210
2578
  : never;
2211
2579
 
2212
2580
  /**
@@ -2220,10 +2588,11 @@ declare namespace EmbeddedCollectionField {
2220
2588
  * A type to infer the initialized element type of an EmbeddedCollectionField from its ElementFieldType.
2221
2589
  * @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
2222
2590
  */
2223
- type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
2224
- ...args: any[]
2225
- ) => Document<any, infer Schema extends DataSchema, any>
2226
- ? SchemaField.InnerPersistedType<Schema>
2591
+ // Note(LukeAbby): For some reason checking `extends Document` causes issues where this doesn't.
2592
+ type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
2593
+ ...args: infer _1
2594
+ ) => { " __fvtt_types_internal_source_data": infer AssignmentData }
2595
+ ? AssignmentData
2227
2596
  : never;
2228
2597
 
2229
2598
  /**
@@ -2258,7 +2627,7 @@ declare namespace EmbeddedCollectionField {
2258
2627
  /**
2259
2628
  * A shorthand for the persisted type of an ArrayField class.
2260
2629
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
2261
- * @typeParam PersistedElementType - the perssited type of the elements of the EmbeddedCollectionField
2630
+ * @typeParam PersistedElementType - the persisted type of the elements of the EmbeddedCollectionField
2262
2631
  * @typeParam Opts - the options that override the default options
2263
2632
  */
2264
2633
  type PersistedType<
@@ -2269,7 +2638,7 @@ declare namespace EmbeddedCollectionField {
2269
2638
  }
2270
2639
 
2271
2640
  /**
2272
- * A subclass of {@link EmbeddedCollectionField} which manages a collection of delta objects relative to another
2641
+ * A subclass of {@link EmbeddedCollectionField | `EmbeddedCollectionField`} which manages a collection of delta objects relative to another
2273
2642
  * collection.
2274
2643
  * @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionDeltaField
2275
2644
  * @typeParam AssignmentElementType - the assignment type for the elements in the collection
@@ -2281,10 +2650,10 @@ declare namespace EmbeddedCollectionField {
2281
2650
  * @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionDeltaField
2282
2651
  * @remarks
2283
2652
  * Defaults:
2284
- * AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
2285
- * InitializedType: `Collection<InitializedElementType>`
2286
- * PersistedType: `PersistedElementType[]`
2287
- * InitialValue: `[]`
2653
+ * - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
2654
+ * - InitializedType: `Collection<InitializedElementType>`
2655
+ * - PersistedType: `PersistedElementType[]`
2656
+ * - InitialValue: `[]`
2288
2657
  */
2289
2658
  declare class EmbeddedCollectionDeltaField<
2290
2659
  ElementFieldType extends Document.AnyConstructor,
@@ -2320,11 +2689,17 @@ declare class EmbeddedCollectionDeltaField<
2320
2689
  > {
2321
2690
  static override get implementation(): typeof EmbeddedCollectionDelta;
2322
2691
 
2323
- protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
2692
+ /**
2693
+ * @remarks Calls the Collection's Document's Implementation's `schema.clean` on every entry in `value`,
2694
+ * with `options.source` set to that entry, and some special handling for Tombstone data
2695
+ * @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
2696
+ */
2697
+ protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
2324
2698
 
2699
+ // options: required (property access with no default)
2325
2700
  protected override _validateElements(
2326
2701
  value: any[],
2327
- options?: DataField.ValidationOptions<DataField.Any>,
2702
+ options: DataField.ValidateOptions<this>,
2328
2703
  ): void | DataModelValidationFailure;
2329
2704
  }
2330
2705
 
@@ -2333,10 +2708,10 @@ declare namespace EmbeddedCollectionDeltaField {
2333
2708
  * A shorthand for the options of an EmbeddedCollectionDeltaField class.
2334
2709
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
2335
2710
  */
2336
- type Options<AssignmentElementType> = DataFieldOptions<ArrayField.BaseAssignmentType<AssignmentElementType>>;
2711
+ type Options<AssignmentElementType> = DataField.Options<ArrayField.BaseAssignmentType<AssignmentElementType>>;
2337
2712
 
2338
2713
  /**
2339
- * The type of the default options for the {@link EmbeddedCollectionDeltaField} class.
2714
+ * The type of the default options for the {@link EmbeddedCollectionDeltaField | `EmbeddedCollectionDeltaField`} class.
2340
2715
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
2341
2716
  */
2342
2717
  type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
@@ -2355,10 +2730,10 @@ declare namespace EmbeddedCollectionDeltaField {
2355
2730
  * A type to infer the assignment element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
2356
2731
  * @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
2357
2732
  */
2358
- type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
2359
- ...args: any[]
2360
- ) => Document<any, infer Schema extends DataSchema, any>
2361
- ? SchemaField.InnerAssignmentType<Schema>
2733
+ type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
2734
+ ...args: infer _1
2735
+ ) => { " __fvtt_types_internal_assignment_data": infer AssignmentData }
2736
+ ? AssignmentData
2362
2737
  : never;
2363
2738
 
2364
2739
  /**
@@ -2372,10 +2747,11 @@ declare namespace EmbeddedCollectionDeltaField {
2372
2747
  * A type to infer the initialized element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
2373
2748
  * @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
2374
2749
  */
2375
- type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
2376
- ...args: any[]
2377
- ) => Document<any, infer Schema extends DataSchema, any>
2378
- ? SchemaField.InnerPersistedType<Schema>
2750
+ // Note(LukeAbby): For some reason checking `extends Document` causes issues where `extends DataModel` doesn't.
2751
+ type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
2752
+ ...args: infer _1
2753
+ ) => { " __fvtt_types_internal_source_data": infer AssignmentData }
2754
+ ? AssignmentData
2379
2755
  : never;
2380
2756
 
2381
2757
  /**
@@ -2410,7 +2786,7 @@ declare namespace EmbeddedCollectionDeltaField {
2410
2786
  /**
2411
2787
  * A shorthand for the persisted type of an ArrayField class.
2412
2788
  * @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
2413
- * @typeParam PersistedElementType - the perssited type of the elements of the EmbeddedCollectionDeltaField
2789
+ * @typeParam PersistedElementType - the persisted type of the elements of the EmbeddedCollectionDeltaField
2414
2790
  * @typeParam Opts - the options that override the default options
2415
2791
  */
2416
2792
  type PersistedType<
@@ -2421,7 +2797,7 @@ declare namespace EmbeddedCollectionDeltaField {
2421
2797
  }
2422
2798
 
2423
2799
  /**
2424
- * A subclass of {@link EmbeddedDataField} which supports a single embedded Document.
2800
+ * A subclass of {@link EmbeddedDataField | `EmbeddedDataField`} which supports a single embedded Document.
2425
2801
  * @typeParam DocumentType - the type of the embedded Document
2426
2802
  * @typeParam Options - the options of the EmbeddedDocumentField instance
2427
2803
  * @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDocumentField
@@ -2429,10 +2805,10 @@ declare namespace EmbeddedCollectionDeltaField {
2429
2805
  * @typeParam PersistedType - the type of the persisted values of the EmbeddedDocumentField
2430
2806
  * @remarks
2431
2807
  * Defaults:
2432
- * AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
2433
- * InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]> | null`
2434
- * PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]> | null`
2435
- * InitialValue: `{}`
2808
+ * - AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
2809
+ * - InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]> | null`
2810
+ * - PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]> | null`
2811
+ * - InitialValue: `{}`
2436
2812
  */
2437
2813
  declare class EmbeddedDocumentField<
2438
2814
  const DocumentType extends Document.AnyConstructor,
@@ -2444,8 +2820,10 @@ declare class EmbeddedDocumentField<
2444
2820
  /**
2445
2821
  * @param model - The type of Document which is embedded.
2446
2822
  * @param options - Options which configure the behavior of the field.
2823
+ * @param context - Additional context which describes the field
2447
2824
  */
2448
- constructor(model: DocumentType, options?: Options, context?: DataField.Context);
2825
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
2826
+ constructor(model: DocumentType, options?: Options, context?: DataField.ConstructionContext);
2449
2827
 
2450
2828
  /** @defaultValue `true` */
2451
2829
  override nullable: boolean;
@@ -2455,10 +2833,11 @@ declare class EmbeddedDocumentField<
2455
2833
  /** @defaultValue `true` */
2456
2834
  static override hierarchical: boolean;
2457
2835
 
2836
+ // options: not null (parameter default only)
2458
2837
  override initialize(
2459
2838
  value: PersistedType,
2460
2839
  model: DataModel.Any,
2461
- options?: AnyObject,
2840
+ options?: DataField.InitializeOptions,
2462
2841
  ): InitializedType | (() => InitializedType | null);
2463
2842
 
2464
2843
  /**
@@ -2469,15 +2848,17 @@ declare class EmbeddedDocumentField<
2469
2848
  }
2470
2849
 
2471
2850
  declare namespace EmbeddedDocumentField {
2851
+ interface Any extends EmbeddedDocumentField<any, any, any, any, any> {}
2852
+
2472
2853
  /**
2473
2854
  * A shorthand for the options of an EmbeddedDocumentField class.
2474
2855
  * @typeParam DocumentType - the type of the embedded Document
2475
2856
  */
2476
- type Options<DocumentType extends Document.AnyConstructor> = DataFieldOptions<
2477
- SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>> | __SchemaFieldInitial
2857
+ type Options<DocumentType extends Document.AnyConstructor> = DataField.Options<
2858
+ SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>> | __SchemaFieldInitial
2478
2859
  >;
2479
2860
 
2480
- /** The type of the default options for the {@link EmbeddedDocumentField} class. */
2861
+ /** The type of the default options for the {@link EmbeddedDocumentField | `EmbeddedDocumentField`} class. */
2481
2862
  type DefaultOptions = SimpleMerge<
2482
2863
  EmbeddedDataField.DefaultOptions,
2483
2864
  {
@@ -2504,7 +2885,7 @@ declare namespace EmbeddedDocumentField {
2504
2885
  DocumentType extends Document.AnyConstructor,
2505
2886
  Opts extends Options<DocumentType>,
2506
2887
  > = DataField.DerivedAssignmentType<
2507
- SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>>,
2888
+ SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>>,
2508
2889
  MergedOptions<DocumentType, Opts>
2509
2890
  >;
2510
2891
 
@@ -2517,7 +2898,7 @@ declare namespace EmbeddedDocumentField {
2517
2898
  DocumentType extends Document.AnyConstructor,
2518
2899
  Opts extends Options<DocumentType>,
2519
2900
  > = DataField.DerivedInitializedType<
2520
- SchemaField.InnerInitializedType<DataModel.SchemaOfClass<DocumentType>>,
2901
+ SchemaField.InitializedData<DataModel.SchemaOfClass<DocumentType>>,
2521
2902
  MergedOptions<DocumentType, Opts>
2522
2903
  >;
2523
2904
 
@@ -2530,13 +2911,13 @@ declare namespace EmbeddedDocumentField {
2530
2911
  DocumentType extends Document.AnyConstructor,
2531
2912
  Opts extends Options<DocumentType>,
2532
2913
  > = DataField.DerivedInitializedType<
2533
- SchemaField.InnerPersistedType<DataModel.SchemaOfClass<DocumentType>>,
2914
+ SchemaField.SourceData<DataModel.SchemaOfClass<DocumentType>>,
2534
2915
  MergedOptions<DocumentType, Opts>
2535
2916
  >;
2536
2917
  }
2537
2918
 
2538
2919
  /**
2539
- * A subclass of [StringField]{@link StringField} which provides the primary _id for a Document.
2920
+ * A subclass of {@link StringField | `StringField`} which provides the primary _id for a Document.
2540
2921
  * The field may be initially null, but it must be non-null when it is saved to the database.
2541
2922
  * @typeParam Options - the options of the DocumentIdField instance
2542
2923
  * @typeParam AssignmentType - the type of the allowed assignment values of the DocumentIdField
@@ -2544,13 +2925,13 @@ declare namespace EmbeddedDocumentField {
2544
2925
  * @typeParam PersistedType - the type of the persisted values of the DocumentIdField
2545
2926
  * @remarks
2546
2927
  * Defaults:
2547
- * AssignmentType: `string | Document.Any | null | undefined`
2548
- * InitializedType: `string | null`
2549
- * PersistedType: `string | null`
2550
- * InitialValue: `null`
2928
+ * - AssignmentType: `string | Document.Any | null | undefined`
2929
+ * - InitializedType: `string | null`
2930
+ * - PersistedType: `string | null`
2931
+ * - InitialValue: `null`
2551
2932
  */
2552
2933
  declare class DocumentIdField<
2553
- Options extends StringFieldOptions = DocumentIdField.DefaultOptions,
2934
+ Options extends DocumentIdField.Options = DocumentIdField.DefaultOptions,
2554
2935
  AssignmentType = DocumentIdField.AssignmentType<Options>,
2555
2936
  InitializedType = DocumentIdField.InitializedType<Options>,
2556
2937
  PersistedType extends string | null | undefined = DocumentIdField.InitializedType<Options>,
@@ -2565,7 +2946,7 @@ declare class DocumentIdField<
2565
2946
  override nullable: boolean;
2566
2947
 
2567
2948
  /** @defaultValue `null` */
2568
- override initial: DataFieldOptions.InitialType<InitializedType>;
2949
+ override initial: DataField.Options.InitialType<InitializedType>;
2569
2950
 
2570
2951
  /** @defaultValue `true` */
2571
2952
  override readonly: boolean;
@@ -2573,18 +2954,23 @@ declare class DocumentIdField<
2573
2954
  /** @defaultValue `"is not a valid Document ID string"` */
2574
2955
  override validationError: string;
2575
2956
 
2576
- protected static override get _defaults(): StringFieldOptions;
2957
+ protected static override get _defaults(): StringField.Options<unknown>;
2577
2958
 
2578
2959
  protected override _cast(value: AssignmentType): InitializedType;
2579
2960
 
2961
+ /** @remarks `options` is unused in `DocumentIdField` */
2580
2962
  protected override _validateType(
2581
2963
  value: InitializedType,
2582
- options?: DataField.ValidationOptions<DataField.Any>,
2964
+ options?: DataField.ValidateOptions<this> | null,
2583
2965
  ): boolean | DataModelValidationFailure | void;
2584
2966
  }
2585
2967
 
2586
2968
  declare namespace DocumentIdField {
2587
- /** The type of the default options for the {@link DocumentIdField} class. */
2969
+ type Options = StringField.Options<unknown> & {
2970
+ readonly?: boolean;
2971
+ };
2972
+
2973
+ /** The type of the default options for the {@link DocumentIdField | `DocumentIdField`} class. */
2588
2974
  type DefaultOptions = SimpleMerge<
2589
2975
  StringField.DefaultOptions,
2590
2976
  {
@@ -2601,13 +2987,13 @@ declare namespace DocumentIdField {
2601
2987
  * A helper type for the given options type merged into the default options of the DocumentIdField class.
2602
2988
  * @typeParam Options - the options that override the default options
2603
2989
  */
2604
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
2990
+ type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<DefaultOptions, Options>;
2605
2991
 
2606
2992
  /**
2607
2993
  * A shorthand for the assignment type of a StringField class.
2608
2994
  * @typeParam Options - the options that override the default options
2609
2995
  */
2610
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
2996
+ type AssignmentType<Options extends StringField.Options<unknown>> = DataField.DerivedAssignmentType<
2611
2997
  string | Document.Any,
2612
2998
  MergedOptions<Options>
2613
2999
  >;
@@ -2616,14 +3002,14 @@ declare namespace DocumentIdField {
2616
3002
  * A shorthand for the initialized type of a StringField class.
2617
3003
  * @typeParam Options - the options that override the default options
2618
3004
  */
2619
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3005
+ type InitializedType<Options extends StringField.Options<unknown>> = DataField.DerivedInitializedType<
2620
3006
  string,
2621
3007
  MergedOptions<Options>
2622
3008
  >;
2623
3009
  }
2624
3010
 
2625
3011
  /**
2626
- * A subclass of {@link StringField} which supports referencing some other Document by its UUID.
3012
+ * A subclass of {@link StringField | `StringField`} which supports referencing some other Document by its UUID.
2627
3013
  * This field may not be blank, but may be null to indicate that no UUID is referenced.
2628
3014
  */
2629
3015
  declare class DocumentUUIDField<
@@ -2636,7 +3022,8 @@ declare class DocumentUUIDField<
2636
3022
  * @param options - Options which configure the behavior of the field
2637
3023
  * @param context - Additional context which describes the field
2638
3024
  */
2639
- constructor(options?: Options, context?: DataField.Context);
3025
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
3026
+ constructor(options?: Options, context?: DataField.ConstructionContext);
2640
3027
 
2641
3028
  /** A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
2642
3029
  type: Document.Type | undefined;
@@ -2646,9 +3033,10 @@ declare class DocumentUUIDField<
2646
3033
 
2647
3034
  static get _defaults(): DocumentUUIDField.Options;
2648
3035
 
3036
+ /** @remarks `options` is unused in `DocumentUUIDField` */
2649
3037
  protected override _validateType(
2650
3038
  value: InitializedType,
2651
- options?: DataField.ValidationOptions<DataField.Any>,
3039
+ options?: DataField.ValidateOptions<this> | null,
2652
3040
  ): boolean | DataModelValidationFailure | void;
2653
3041
 
2654
3042
  // These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
@@ -2681,14 +3069,13 @@ declare class DocumentUUIDField<
2681
3069
  }
2682
3070
 
2683
3071
  declare namespace DocumentUUIDField {
2684
- type Options = StringFieldOptions &
2685
- StringFieldOptions & {
2686
- /* A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
2687
- type?: Document.Type | undefined;
3072
+ type Options = StringField.Options & {
3073
+ /* A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
3074
+ type?: Document.Type | undefined;
2688
3075
 
2689
- /* Does this field require (or prohibit) embedded documents? */
2690
- embedded?: boolean | undefined;
2691
- };
3076
+ /* Does this field require (or prohibit) embedded documents? */
3077
+ embedded?: boolean | undefined;
3078
+ };
2692
3079
 
2693
3080
  type DefaultOptions = SimpleMerge<
2694
3081
  StringField.DefaultOptions,
@@ -2722,7 +3109,7 @@ declare namespace DocumentUUIDField {
2722
3109
  }
2723
3110
 
2724
3111
  /**
2725
- * A special class of [StringField]{@link StringField} field which references another DataModel by its id.
3112
+ * A special class of {@link StringField | `StringField`} field which references another DataModel by its id.
2726
3113
  * This field may also be null to indicate that no foreign model is linked.
2727
3114
  * @typeParam DocumentType - the type of the foreign document constructor
2728
3115
  * @typeParam Options - the options for the ForeignDocumentField
@@ -2731,10 +3118,10 @@ declare namespace DocumentUUIDField {
2731
3118
  * @typeParam PersistedType - the type of the persisted values of the ForeignDocumentField
2732
3119
  * @remarks
2733
3120
  * Defaults:
2734
- * AssignmentType: `string | InstanceType<DocumentType> | null | undefined`
2735
- * InitializedType: `InstanceType<DocumentType> | null`
2736
- * PersistedType: `string | null`
2737
- * InitialValue: `null`
3121
+ * - AssignmentType: `string | InstanceType<DocumentType> | null | undefined`
3122
+ * - InitializedType: `InstanceType<DocumentType> | null`
3123
+ * - PersistedType: `string | null`
3124
+ * - InitialValue: `null`
2738
3125
  */
2739
3126
  declare class ForeignDocumentField<
2740
3127
  DocumentType extends Document.AnyConstructor,
@@ -2746,8 +3133,12 @@ declare class ForeignDocumentField<
2746
3133
  /**
2747
3134
  * @param model - The foreign DataModel class definition which this field should link to.
2748
3135
  * @param options - Options which configure the behavior of the field
3136
+ * @param context - Additional context which describes the field
3137
+ *
3138
+ * @privateRemarks Technically the runtime check allows any DataModel, but that seems unintended
2749
3139
  */
2750
- constructor(model: DocumentType, options?: Options, context?: DataField.Context);
3140
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
3141
+ constructor(model: DocumentType, options?: Options, context?: DataField.ConstructionContext);
2751
3142
 
2752
3143
  /** @defaultValue `true` */
2753
3144
  override nullable: boolean;
@@ -2767,24 +3158,27 @@ declare class ForeignDocumentField<
2767
3158
 
2768
3159
  protected override _cast(value: AssignmentType): InitializedType;
2769
3160
 
3161
+ // options: not null (parameter default only)
2770
3162
  override initialize(
2771
3163
  value: PersistedType,
2772
3164
  model: DataModel.Any,
2773
- options?: AnyObject,
3165
+ options?: DataField.InitializeOptions,
2774
3166
  ): InitializedType | (() => InitializedType | null);
2775
3167
 
2776
3168
  override toObject(value: InitializedType): PersistedType;
3169
+
3170
+ //TODO: _toInput
2777
3171
  }
2778
3172
 
2779
3173
  declare namespace ForeignDocumentField {
2780
3174
  /** The options for the ForeignDocumentField class. */
2781
- type Options = StringFieldOptions &
2782
- DataFieldOptions<string | Document.Any> & {
2783
- // Making this ---------^ more concrete leads to excessively deep instantiation
2784
- idOnly?: boolean;
2785
- };
3175
+ // TODO(LukeAbby)
3176
+ interface Options extends StringField.Options<string | Document.Any> {
3177
+ // ^ Making this more concrete leads to excessively deep instantiation
3178
+ idOnly?: boolean;
3179
+ }
2786
3180
 
2787
- /** The type of the default options for the {@link ForeignDocumentField} class. */
3181
+ /** The type of the default options for the {@link ForeignDocumentField | `ForeignDocumentField`} class. */
2788
3182
  type DefaultOptions = SimpleMerge<
2789
3183
  DocumentIdField.DefaultOptions,
2790
3184
  {
@@ -2807,7 +3201,7 @@ declare namespace ForeignDocumentField {
2807
3201
  type AssignmentType<
2808
3202
  ConcreteDocument extends Document.AnyConstructor,
2809
3203
  Opts extends Options,
2810
- > = DataField.DerivedAssignmentType<string | Document.ToConfiguredClass<ConcreteDocument>, MergedOptions<Opts>>;
3204
+ > = DataField.DerivedAssignmentType<string | Document.ToConfiguredInstance<ConcreteDocument>, MergedOptions<Opts>>;
2811
3205
 
2812
3206
  /**
2813
3207
  * A shorthand for the initialized type of a ForeignDocumentField class.
@@ -2829,20 +3223,20 @@ declare namespace ForeignDocumentField {
2829
3223
  }
2830
3224
 
2831
3225
  /**
2832
- * A special [StringField]{@link StringField} which records a standardized CSS color string.
3226
+ * A special {@link StringField | `StringField`} which records a standardized CSS color string.
2833
3227
  * @typeParam Options - the options of the ColorField instance
2834
3228
  * @typeParam AssignmentType - the type of the allowed assignment values of the ColorField
2835
3229
  * @typeParam InitializedType - the type of the initialized values of the ColorField
2836
3230
  * @typeParam PersistedType - the type of the persisted values of the ColorField
2837
3231
  * @remarks
2838
3232
  * Defaults:
2839
- * AssignmentType: `string | null | undefined`
2840
- * InitializedType: `string | null`
2841
- * PersistedType: `string | null`
2842
- * InitialValue: `null`
3233
+ * - AssignmentType: `string | null | undefined`
3234
+ * - InitializedType: `string | null`
3235
+ * - PersistedType: `string | null`
3236
+ * - InitialValue: `null`
2843
3237
  */
2844
3238
  declare class ColorField<
2845
- Options extends StringFieldOptions = ColorField.DefaultOptions,
3239
+ Options extends StringField.Options = ColorField.DefaultOptions,
2846
3240
  AssignmentType = ColorField.AssignmentType<Options>,
2847
3241
  InitializedType = ColorField.InitializedType<Options>,
2848
3242
  PersistedType extends string | null | undefined = ColorField.PersistedType<Options>,
@@ -2851,7 +3245,7 @@ declare class ColorField<
2851
3245
  override nullable: boolean;
2852
3246
 
2853
3247
  /** @defaultValue `null` */
2854
- override initial: DataFieldOptions.InitialType<InitializedType>;
3248
+ override initial: DataField.Options.InitialType<InitializedType>;
2855
3249
 
2856
3250
  /** @defaultValue `false` */
2857
3251
  override blank: boolean;
@@ -2859,18 +3253,38 @@ declare class ColorField<
2859
3253
  /** @defaultValue `"is not a valid hexadecimal color string"` */
2860
3254
  override validationError: string;
2861
3255
 
2862
- protected static override get _defaults(): StringFieldOptions;
3256
+ protected static override get _defaults(): StringField.Options;
2863
3257
 
2864
- override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
3258
+ // options: not null (parameter default only)
3259
+ override initialize(
3260
+ value: PersistedType,
3261
+ model: DataModel.Any,
3262
+ options?: DataField.InitializeOptions,
3263
+ ): InitializedType | (() => InitializedType | null);
3264
+
3265
+ /** @throws If the value isn't a valid {@link foundry.utils.Color.Source | `Color.Source`} *after* going through `super` */
3266
+ override getInitialValue(data?: unknown): InitializedType;
3267
+
3268
+ protected override _cast(value: AssignmentType): InitializedType;
3269
+
3270
+ /**
3271
+ * @remarks Returns `value.css` if it's a `.valid` `Color`, otherwise `this.getInitialValue(options.source)`
3272
+ *
3273
+ * `options` is required as it lacks any default handling and has its `.source` property accessed
3274
+ */
3275
+ protected override _cleanType(value: InitializedType, options: DataField.CleanOptions): InitializedType;
2865
3276
 
3277
+ /** @remarks `options` is only passed to super, where it is unused in `StringField` */
2866
3278
  protected override _validateType(
2867
3279
  value: InitializedType,
2868
- options?: DataField.ValidationOptions<DataField.Any>,
3280
+ options?: DataField.ValidateOptions<this> | null,
2869
3281
  ): boolean | DataModelValidationFailure | void;
3282
+
3283
+ protected override _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
2870
3284
  }
2871
3285
 
2872
3286
  declare namespace ColorField {
2873
- /** The type of the default options for the {@link ColorField} class. */
3287
+ /** The type of the default options for the {@link ColorField | `ColorField`} class. */
2874
3288
  type DefaultOptions = SimpleMerge<
2875
3289
  StringField.DefaultOptions,
2876
3290
  {
@@ -2885,13 +3299,13 @@ declare namespace ColorField {
2885
3299
  * A helper type for the given options type merged into the default options of the ColorField class.
2886
3300
  * @typeParam Options - the options that override the default options
2887
3301
  */
2888
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3302
+ type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
2889
3303
 
2890
3304
  /**
2891
3305
  * A shorthand for the assignment type of a ColorField class.
2892
3306
  * @typeParam Options - the options that override the default options
2893
3307
  */
2894
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
3308
+ type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
2895
3309
  string,
2896
3310
  MergedOptions<Options>
2897
3311
  >;
@@ -2900,7 +3314,7 @@ declare namespace ColorField {
2900
3314
  * A shorthand for the initialized type of a ColorField class.
2901
3315
  * @typeParam Options - the options that override the default options
2902
3316
  */
2903
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3317
+ type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
2904
3318
  Color,
2905
3319
  MergedOptions<Options>
2906
3320
  >;
@@ -2909,60 +3323,37 @@ declare namespace ColorField {
2909
3323
  * A shorthand for the persisted type of a ColorField class.
2910
3324
  * @typeParam Options - the options that override the default options
2911
3325
  */
2912
- type PersistedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3326
+ type PersistedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
2913
3327
  string,
2914
3328
  MergedOptions<Options>
2915
3329
  >;
2916
3330
  }
2917
3331
 
2918
- declare global {
2919
- /**
2920
- * @typeParam Value - the type of the value of the field
2921
- */
2922
- interface FilePathFieldOptions extends StringFieldOptions {
2923
- /**
2924
- * A set of categories in CONST.FILE_CATEGORIES which this field supports
2925
- * @defaultValue `[]`
2926
- */
2927
- categories?: (keyof typeof CONST.FILE_CATEGORIES)[];
2928
-
2929
- /**
2930
- * Is embedded base64 data supported in lieu of a file path?
2931
- * @defaultValue `false`
2932
- */
2933
- base64?: boolean;
2934
-
2935
- /**
2936
- * Does this file path field allow wildcard characters?
2937
- * @defaultValue `false`
2938
- */
2939
- wildcard?: boolean;
2940
- }
2941
- }
2942
-
2943
3332
  /**
2944
- * A special [StringField]{@link StringField} which records a file path or inline base64 data.
3333
+ * A special {@link StringField | `StringField`} which records a file path or inline base64 data.
2945
3334
  * @typeParam Options - the options of the FilePathField instance
2946
3335
  * @typeParam AssignmentType - the type of the allowed assignment values of the FilePathField
2947
3336
  * @typeParam InitializedType - the type of the initialized values of the FilePathField
2948
3337
  * @typeParam PersistedType - the type of the persisted values of the FilePathField
2949
3338
  * @remarks
2950
3339
  * Defaults:
2951
- * AssignmentType: `string | null | undefined`
2952
- * InitializedType: `string | null`
2953
- * PersistedType: `string | null`
2954
- * InitialValue: `null`
3340
+ * - AssignmentType: `string | null | undefined`
3341
+ * - InitializedType: `string | null`
3342
+ * - PersistedType: `string | null`
3343
+ * - InitialValue: `null`
2955
3344
  */
2956
3345
  declare class FilePathField<
2957
- Options extends FilePathFieldOptions = FilePathField.DefaultOptions,
3346
+ Options extends FilePathField.Options = FilePathField.DefaultOptions,
2958
3347
  AssignmentType = FilePathField.AssignmentType<Options>,
2959
3348
  InitializedType = FilePathField.InitializedType<Options>,
2960
3349
  PersistedType extends string | null | undefined = FilePathField.InitializedType<Options>,
2961
3350
  > extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
2962
3351
  /**
2963
3352
  * @param options - Options which configure the behavior of the field
3353
+ * @param context - Additional context which describes the field
2964
3354
  */
2965
- constructor(options?: Options, context?: DataField.Context);
3355
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
3356
+ constructor(options?: Options, context?: DataField.ConstructionContext);
2966
3357
 
2967
3358
  /**
2968
3359
  * A set of categories in CONST.FILE_CATEGORIES which this field supports
@@ -2989,20 +3380,23 @@ declare class FilePathField<
2989
3380
  override blank: boolean;
2990
3381
 
2991
3382
  /** @defaultValue `null` */
2992
- override initial: DataFieldOptions.InitialType<InitializedType>;
3383
+ override initial: DataField.Options.InitialType<InitializedType>;
2993
3384
 
2994
- protected static override get _defaults(): FilePathFieldOptions;
3385
+ protected static override get _defaults(): FilePathField.Options;
2995
3386
 
2996
3387
  override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
2997
3388
 
3389
+ /** @remarks `options` is unused in `FilePathField` */
2998
3390
  protected override _validateType(
2999
3391
  value: InitializedType,
3000
- options?: DataField.ValidationOptions<DataField.Any>,
3392
+ options?: DataField.ValidateOptions<this>,
3001
3393
  ): boolean | DataModelValidationFailure | void;
3394
+
3395
+ // TODO: _toInput
3002
3396
  }
3003
3397
 
3004
3398
  declare namespace FilePathField {
3005
- /** The type of the default options for the {@link FilePathField} class. */
3399
+ /** The type of the default options for the {@link FilePathField | `FilePathField`} class. */
3006
3400
  type DefaultOptions = SimpleMerge<
3007
3401
  StringField.DefaultOptions,
3008
3402
  {
@@ -3015,17 +3409,37 @@ declare namespace FilePathField {
3015
3409
  }
3016
3410
  >;
3017
3411
 
3412
+ interface Options extends StringField.Options {
3413
+ /**
3414
+ * A set of categories in CONST.FILE_CATEGORIES which this field supports
3415
+ * @defaultValue `[]`
3416
+ */
3417
+ categories?: (keyof typeof CONST.FILE_CATEGORIES)[];
3418
+
3419
+ /**
3420
+ * Is embedded base64 data supported in lieu of a file path?
3421
+ * @defaultValue `false`
3422
+ */
3423
+ base64?: boolean;
3424
+
3425
+ /**
3426
+ * Does this file path field allow wildcard characters?
3427
+ * @defaultValue `false`
3428
+ */
3429
+ wildcard?: boolean;
3430
+ }
3431
+
3018
3432
  /**
3019
3433
  * A helper type for the given options type merged into the default options of the FilePathField class.
3020
3434
  * @typeParam Options - the options that override the default options
3021
3435
  */
3022
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3436
+ type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
3023
3437
 
3024
3438
  /**
3025
3439
  * A shorthand for the assignment type of a FilePathField class.
3026
3440
  * @typeParam Options - the options that override the default options
3027
3441
  */
3028
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
3442
+ type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
3029
3443
  string,
3030
3444
  MergedOptions<Options>
3031
3445
  >;
@@ -3034,31 +3448,38 @@ declare namespace FilePathField {
3034
3448
  * A shorthand for the initialized type of a FilePathField class.
3035
3449
  * @typeParam Options - the options that override the default options
3036
3450
  */
3037
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3451
+ type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
3038
3452
  string,
3039
3453
  MergedOptions<Options>
3040
3454
  >;
3041
3455
  }
3042
3456
 
3043
3457
  /**
3044
- * A special [NumberField]{@link NumberField} which represents an angle of rotation in degrees between 0 and 360.
3458
+ * A special {@link NumberField | `NumberField`} which represents an angle of rotation in degrees between 0 and 360.
3045
3459
  * @typeParam Options - the options of the AngleField instance
3046
3460
  * @typeParam AssignmentType - the type of the allowed assignment values of the AngleField
3047
3461
  * @typeParam InitializedType - the type of the initialized values of the AngleField
3048
3462
  * @typeParam PersistedType - the type of the persisted values of the AngleField
3049
3463
  * @remarks
3050
3464
  * Defaults:
3051
- * AssignmentType: `number | null | undefined`
3052
- * InitializedType: `number`
3053
- * PersistedType: `number`
3054
- * InitialValue: `0`
3465
+ * - AssignmentType: `number | null | undefined`
3466
+ * - InitializedType: `number`
3467
+ * - PersistedType: `number`
3468
+ * - InitialValue: `0`
3055
3469
  */
3056
3470
  declare class AngleField<
3057
- Options extends NumberFieldOptions = AngleField.DefaultOptions,
3471
+ Options extends NumberField.Options = AngleField.DefaultOptions,
3058
3472
  AssignmentType = AngleField.AssignmentType<Options>,
3059
3473
  InitializedType = AngleField.InitializedType<Options>,
3060
3474
  PersistedType extends number | null | undefined = AngleField.InitializedType<Options>,
3061
3475
  > extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
3476
+ /**
3477
+ * @param options - Options which configure the behavior of the field
3478
+ * @param context - Additional context which describes the field
3479
+ */
3480
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
3481
+ constructor(options?: Options, context?: DataField.ConstructionContext);
3482
+
3062
3483
  /** @defaultValue `true` */
3063
3484
  override required: boolean;
3064
3485
 
@@ -3066,10 +3487,13 @@ declare class AngleField<
3066
3487
  override nullable: boolean;
3067
3488
 
3068
3489
  /** @defaultValue `0` */
3069
- override initial: DataFieldOptions.InitialType<InitializedType>;
3490
+ override initial: DataField.Options.InitialType<InitializedType>;
3070
3491
 
3071
- /** @defaultValue `0` */
3072
- base: number;
3492
+ /**
3493
+ * Whether the angle should be normalized to [0,360) before being clamped to [0,360]. The default is true.
3494
+ * @defaultValue `true`
3495
+ */
3496
+ normalize: boolean;
3073
3497
 
3074
3498
  /** @defaultValue `0` */
3075
3499
  override min: number | undefined;
@@ -3080,20 +3504,28 @@ declare class AngleField<
3080
3504
  /** @defaultValue `"is not a number between 0 and 360"` */
3081
3505
  override validationError: string;
3082
3506
 
3083
- protected static override get _defaults(): NumberFieldOptions;
3507
+ protected static override get _defaults(): NumberField.Options;
3084
3508
 
3085
3509
  protected override _cast(value: AssignmentType): InitializedType;
3510
+
3511
+ /**
3512
+ * @deprecated since v12, until v14
3513
+ * @remarks "The `AngleField#base` is deprecated in favor of {@link AngleField.normalize | `AngleField#normalize`}."
3514
+ */
3515
+ get base(): number;
3516
+
3517
+ set base(value);
3086
3518
  }
3087
3519
 
3088
3520
  declare namespace AngleField {
3089
- /** The type of the default options for the {@link AngleField} class. */
3521
+ /** The type of the default options for the {@link AngleField | `AngleField`} class. */
3090
3522
  type DefaultOptions = SimpleMerge<
3091
3523
  NumberField.DefaultOptions,
3092
3524
  {
3093
3525
  required: true;
3094
3526
  nullable: false;
3095
3527
  initial: 0;
3096
- base: 0;
3528
+ normalize: true;
3097
3529
  min: 0;
3098
3530
  max: 360;
3099
3531
  validationError: "is not a number between 0 and 360";
@@ -3104,13 +3536,13 @@ declare namespace AngleField {
3104
3536
  * A helper type for the given options type merged into the default options of the AngleField class.
3105
3537
  * @typeParam Options - the options that override the default options
3106
3538
  */
3107
- type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3539
+ type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
3108
3540
 
3109
3541
  /**
3110
3542
  * A shorthand for the assignment type of a AngleField class.
3111
3543
  * @typeParam Options - the options that override the default options
3112
3544
  */
3113
- type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
3545
+ type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
3114
3546
  number,
3115
3547
  MergedOptions<Options>
3116
3548
  >;
@@ -3119,27 +3551,27 @@ declare namespace AngleField {
3119
3551
  * A shorthand for the initialized type of a AngleField class.
3120
3552
  * @typeParam Options - the options that override the default options
3121
3553
  */
3122
- type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
3554
+ type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
3123
3555
  number,
3124
3556
  MergedOptions<Options>
3125
3557
  >;
3126
3558
  }
3127
3559
 
3128
3560
  /**
3129
- * A special [NumberField]{@link NumberField} represents a number between 0 and 1.
3561
+ * A special {@link NumberField | `NumberField`} represents a number between 0 and 1.
3130
3562
  * @typeParam Options - the options of the AlphaField instance
3131
3563
  * @typeParam AssignmentType - the type of the allowed assignment values of the AlphaField
3132
3564
  * @typeParam InitializedType - the type of the initialized values of the AlphaField
3133
3565
  * @typeParam PersistedType - the type of the persisted values of the AlphaField
3134
3566
  * @remarks
3135
3567
  * Defaults:
3136
- * AssignmentType: `number | null | undefined`
3137
- * InitializedType: `number`
3138
- * PersistedType: `number`
3139
- * InitialValue: `1`
3568
+ * - AssignmentType: `number | null | undefined`
3569
+ * - InitializedType: `number`
3570
+ * - PersistedType: `number`
3571
+ * - InitialValue: `1`
3140
3572
  */
3141
3573
  declare class AlphaField<
3142
- Options extends NumberFieldOptions = AlphaField.DefaultOptions,
3574
+ Options extends NumberField.Options = AlphaField.DefaultOptions,
3143
3575
  AssignmentType = AlphaField.AssignmentType<Options>,
3144
3576
  InitializedType = AlphaField.InitializedType<Options>,
3145
3577
  PersistedType extends number | null | undefined = AlphaField.InitializedType<Options>,
@@ -3151,7 +3583,7 @@ declare class AlphaField<
3151
3583
  override nullable: boolean;
3152
3584
 
3153
3585
  /** @defaultValue `1` */
3154
- override initial: DataFieldOptions.InitialType<InitializedType>;
3586
+ override initial: DataField.Options.InitialType<InitializedType>;
3155
3587
 
3156
3588
  /** @defaultValue `0` */
3157
3589
  override min: number | undefined;
@@ -3162,11 +3594,11 @@ declare class AlphaField<
3162
3594
  /** @defaultValue `"is not a number between 0 and 1"` */
3163
3595
  override validationError: string;
3164
3596
 
3165
- protected static override get _defaults(): NumberFieldOptions;
3597
+ protected static override get _defaults(): NumberField.Options;
3166
3598
  }
3167
3599
 
3168
3600
  declare namespace AlphaField {
3169
- /** The type of the default options for the {@link AlphaField} class. */
3601
+ /** The type of the default options for the {@link AlphaField | `AlphaField`} class. */
3170
3602
  type DefaultOptions = SimpleMerge<
3171
3603
  NumberField.DefaultOptions,
3172
3604
  {
@@ -3183,13 +3615,13 @@ declare namespace AlphaField {
3183
3615
  * A helper type for the given options type merged into the default options of the AlphaField class.
3184
3616
  * @typeParam Options - the options that override the default options
3185
3617
  */
3186
- type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3618
+ type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
3187
3619
 
3188
3620
  /**
3189
3621
  * A shorthand for the assignment type of a AlphaField class.
3190
3622
  * @typeParam Options - the options that override the default options
3191
3623
  */
3192
- type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
3624
+ type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
3193
3625
  number,
3194
3626
  MergedOptions<Options>
3195
3627
  >;
@@ -3198,18 +3630,18 @@ declare namespace AlphaField {
3198
3630
  * A shorthand for the initialized type of a AlphaField class.
3199
3631
  * @typeParam Options - the options that override the default options
3200
3632
  */
3201
- type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
3633
+ type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
3202
3634
  number,
3203
3635
  MergedOptions<Options>
3204
3636
  >;
3205
3637
  }
3206
3638
 
3207
3639
  /**
3208
- * A special [NumberField]{@link NumberField} represents a number between 0 (inclusive) and 1 (exclusive).
3640
+ * A special {@link NumberField | `NumberField`} represents a number between 0 (inclusive) and 1 (exclusive).
3209
3641
  * Its values are normalized (modulo 1) to the range [0, 1) instead of being clamped.
3210
3642
  */
3211
3643
  declare class HueField<
3212
- const Options extends NumberFieldOptions = NumberField.DefaultOptions,
3644
+ const Options extends NumberField.Options = NumberField.DefaultOptions,
3213
3645
  const AssignmentType = NumberField.AssignmentType<Options>,
3214
3646
  const InitializedType = NumberField.InitializedType<Options>,
3215
3647
  const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
@@ -3220,7 +3652,7 @@ declare class HueField<
3220
3652
  }
3221
3653
 
3222
3654
  declare namespace HueField {
3223
- type Options = NumberFieldOptions;
3655
+ type Options = NumberField.Options;
3224
3656
 
3225
3657
  type DefaultOptions = SimpleMerge<
3226
3658
  NumberField.DefaultOptions,
@@ -3236,17 +3668,17 @@ declare namespace HueField {
3236
3668
  }
3237
3669
 
3238
3670
  /**
3239
- * A special [ObjectField]{@link ObjectField} which captures a mapping of User IDs to Document permission levels.
3671
+ * A special {@link ObjectField | `ObjectField`} which captures a mapping of User IDs to Document permission levels.
3240
3672
  * @typeParam Options - the options of the DocumentOwnershipField instance
3241
3673
  * @typeParam AssignmentType - the type of the allowed assignment values of the DocumentOwnershipField
3242
3674
  * @typeParam InitializedType - the type of the initialized values of the DocumentOwnershipField
3243
3675
  * @typeParam PersistedType - the type of the persisted values of the DocumentOwnershipField
3244
3676
  * @remarks
3245
3677
  * Defaults:
3246
- * AssignmentType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS> | null | undefined`
3247
- * InitializedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
3248
- * PersistedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
3249
- * InitialValue: `{ default: DOCUMENT_OWNERSHIP_LEVELS.NONE }`
3678
+ * - AssignmentType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS> | null | undefined`
3679
+ * - InitializedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
3680
+ * - PersistedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
3681
+ * - InitialValue: `{ default: DOCUMENT_OWNERSHIP_LEVELS.NONE }`
3250
3682
  */
3251
3683
  declare class DocumentOwnershipField<
3252
3684
  Options extends DocumentOwnershipField.Options = DocumentOwnershipField.DefaultOptions,
@@ -3258,24 +3690,25 @@ declare class DocumentOwnershipField<
3258
3690
  | undefined = DocumentOwnershipField.InitializedType<Options>,
3259
3691
  > extends ObjectField<Options, AssignmentType, InitializedType, PersistedType> {
3260
3692
  /** @defaultValue `{"default": DOCUMENT_OWNERSHIP_LEVELS.NONE}` */
3261
- override initial: DataFieldOptions.InitialType<InitializedType>;
3693
+ override initial: DataField.Options.InitialType<InitializedType>;
3262
3694
 
3263
3695
  /** @defaultValue `"is not a mapping of user IDs and document permission levels"` */
3264
3696
  override validationError: string;
3265
3697
 
3266
3698
  protected static override get _defaults(): DocumentOwnershipField.Options;
3267
3699
 
3700
+ /** @remarks `options` is unused in `DocumentOwnershipField` */
3268
3701
  protected override _validateType(
3269
3702
  value: InitializedType,
3270
- options?: DataField.ValidationOptions<DataField.Any>,
3703
+ options?: DataField.ValidateOptions<this> | null,
3271
3704
  ): boolean | DataModelValidationFailure | void;
3272
3705
  }
3273
3706
 
3274
3707
  declare namespace DocumentOwnershipField {
3275
3708
  /** A shorthand for the options of a DocumentOwnershipField class. */
3276
- type Options = DataFieldOptions<Record<string, DOCUMENT_OWNERSHIP_LEVELS>>;
3709
+ type Options = DataField.Options<Record<string, DOCUMENT_OWNERSHIP_LEVELS>>;
3277
3710
 
3278
- /** The type of the default options for the {@link DocumentOwnershipField} class. */
3711
+ /** The type of the default options for the {@link DocumentOwnershipField | `DocumentOwnershipField`} class. */
3279
3712
  type DefaultOptions = SimpleMerge<
3280
3713
  ObjectField.DefaultOptions,
3281
3714
  {
@@ -3310,49 +3743,52 @@ declare namespace DocumentOwnershipField {
3310
3743
  }
3311
3744
 
3312
3745
  /**
3313
- * A special [StringField]{@link StringField} which contains serialized JSON data.
3746
+ * A special {@link StringField | `StringField`} which contains serialized JSON data.
3314
3747
  * @typeParam Options - the options of the JSONField instance
3315
3748
  * @typeParam AssignmentType - the type of the allowed assignment values of the JSONField
3316
3749
  * @typeParam InitializedType - the type of the initialized values of the JSONField
3317
3750
  * @typeParam PersistedType - the type of the persisted values of the JSONField
3318
3751
  * @remarks
3319
3752
  * Defaults:
3320
- * AssignmentType: `string | null | undefined`
3321
- * InitializedType: `object | undefined`
3322
- * PersistedType: `string | undefined`
3323
- * InitialValue: `undefined`
3753
+ * - AssignmentType: `string | null | undefined`
3754
+ * - InitializedType: `object | undefined`
3755
+ * - PersistedType: `string | undefined`
3756
+ * - InitialValue: `undefined`
3324
3757
  */
3325
3758
  declare class JSONField<
3326
3759
  // TODO(LukeAbby): Due to the unconditional setting of `blank`, `trim`, and `choices` setting them is meaningless which basically means they're removed from the options.
3327
- Options extends StringFieldOptions = JSONField.DefaultOptions,
3760
+ Options extends StringField.Options = JSONField.DefaultOptions,
3328
3761
  AssignmentType = JSONField.AssignmentType<Options>,
3329
3762
  InitializedType = JSONField.InitializedType<Options>,
3330
3763
  PersistedType extends string | null | undefined = JSONField.PersistedType<Options>,
3331
3764
  > extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
3332
- constructor(options?: Options, context?: DataField.Context);
3765
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
3766
+ constructor(options?: Options, context?: DataField.ConstructionContext);
3333
3767
 
3334
3768
  /** @defaultValue `false` */
3335
3769
  override blank: boolean;
3336
3770
 
3337
3771
  /** @defaultValue `undefined` */
3338
- override initial: DataFieldOptions.InitialType<InitializedType>;
3772
+ override initial: DataField.Options.InitialType<InitializedType>;
3339
3773
 
3340
3774
  /** @defaultValue `"is not a valid JSON string"` */
3341
3775
  override validationError: string;
3342
3776
 
3343
- protected static override get _defaults(): StringFieldOptions;
3777
+ protected static override get _defaults(): StringField.Options;
3344
3778
 
3345
3779
  override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
3346
3780
 
3781
+ /** @remarks `options` is unused in `JSONField` */
3347
3782
  protected override _validateType(
3348
3783
  value: InitializedType,
3349
- options?: DataField.ValidationOptions<DataField.Any>,
3784
+ options?: DataField.ValidateOptions<this> | null,
3350
3785
  ): boolean | DataModelValidationFailure | void;
3351
3786
 
3787
+ // options: not null (parameter default only)
3352
3788
  override initialize(
3353
3789
  value: PersistedType,
3354
3790
  model: DataModel.Any,
3355
- options?: AnyObject,
3791
+ options?: DataField.InitializeOptions,
3356
3792
  ): InitializedType | (() => InitializedType | null);
3357
3793
 
3358
3794
  override toObject(value: InitializedType): PersistedType;
@@ -3383,7 +3819,7 @@ declare class JSONField<
3383
3819
  }
3384
3820
 
3385
3821
  declare namespace JSONField {
3386
- /** The type of the default options for the {@link JSONField} class. */
3822
+ /** The type of the default options for the {@link JSONField | `JSONField`} class. */
3387
3823
  type DefaultOptions = SimpleMerge<
3388
3824
  StringField.DefaultOptions,
3389
3825
  {
@@ -3397,13 +3833,13 @@ declare namespace JSONField {
3397
3833
  * A helper type for the given options type merged into the default options of the JSONField class.
3398
3834
  * @typeParam Options - the options that override the default options
3399
3835
  */
3400
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3836
+ type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
3401
3837
 
3402
3838
  /**
3403
3839
  * A shorthand for the assignment type of a JSONField class.
3404
3840
  * @typeParam Options - the options that override the default options
3405
3841
  */
3406
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
3842
+ type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
3407
3843
  string,
3408
3844
  MergedOptions<Options>
3409
3845
  >;
@@ -3412,7 +3848,7 @@ declare namespace JSONField {
3412
3848
  * A shorthand for the initialized type of a JSONField class.
3413
3849
  * @typeParam Options - the options that override the default options
3414
3850
  */
3415
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3851
+ type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
3416
3852
  AnyObject,
3417
3853
  MergedOptions<Options>
3418
3854
  >;
@@ -3421,29 +3857,35 @@ declare namespace JSONField {
3421
3857
  * A shorthand for the persisted type of a JSONField class.
3422
3858
  * @typeParam Options - the options that override the default options
3423
3859
  */
3424
- type PersistedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3860
+ type PersistedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
3425
3861
  string,
3426
3862
  MergedOptions<Options>
3427
3863
  >;
3428
3864
  }
3429
3865
 
3430
3866
  /**
3431
- * A special subclass of {@link DataField} which can contain any value of any type.
3867
+ * A special subclass of {@link DataField | `DataField`} which can contain any value of any type.
3432
3868
  * Any input is accepted and is treated as valid.
3433
3869
  * It is not recommended to use this class except for very specific circumstances.
3434
3870
  */
3435
3871
  // TODO(LukeAbby): This field effectively removes all options because there's no point asking for an options when none of them do anything.
3436
- declare class AnyField extends DataField<DataFieldOptions.Any, unknown, unknown, unknown> {
3872
+ declare class AnyField extends DataField<DataField.Options.Any, unknown, unknown, unknown> {
3873
+ /** @remarks Simply returns `value` */
3437
3874
  override _cast(value: unknown): unknown;
3438
3875
 
3876
+ /**
3877
+ * @remarks `options` is unused in `AnyField`
3878
+ *
3879
+ * Always returns `true`
3880
+ */
3439
3881
  protected override _validateType(
3440
3882
  value: unknown,
3441
- options?: DataField.ValidationOptions<DataField.Any>,
3883
+ options?: DataField.ValidateOptions<this> | null,
3442
3884
  ): boolean | DataModelValidationFailure | void;
3443
3885
  }
3444
3886
 
3445
3887
  /**
3446
- * A subclass of [StringField]{@link StringField} which contains a sanitized HTML string.
3888
+ * A subclass of {@link StringField | `StringField`} which contains a sanitized HTML string.
3447
3889
  * This class does not override any StringField behaviors, but is used by the server-side to identify fields which
3448
3890
  * require sanitization of user input.
3449
3891
  * @typeParam Options - the options of the HTMLField instance
@@ -3452,13 +3894,13 @@ declare class AnyField extends DataField<DataFieldOptions.Any, unknown, unknown,
3452
3894
  * @typeParam PersistedType - the type of the persisted values of the HTMLField
3453
3895
  * @remarks
3454
3896
  * Defaults:
3455
- * AssignmentType: `string | null | undefined`
3456
- * InitializedType: `string`
3457
- * PersistedType: `string`
3458
- * InitialValue: `""`
3897
+ * - AssignmentType: `string | null | undefined`
3898
+ * - InitializedType: `string`
3899
+ * - PersistedType: `string`
3900
+ * - InitialValue: `""`
3459
3901
  */
3460
3902
  declare class HTMLField<
3461
- Options extends StringFieldOptions = HTMLField.DefaultOptions,
3903
+ Options extends StringField.Options = HTMLField.DefaultOptions,
3462
3904
  AssignmentType = HTMLField.AssignmentType<Options>,
3463
3905
  InitializedType = HTMLField.InitializedType<Options>,
3464
3906
  PersistedType extends string | null | undefined = HTMLField.InitializedType<Options>,
@@ -3469,9 +3911,10 @@ declare class HTMLField<
3469
3911
  /** @defaultValue `true` */
3470
3912
  override blank: boolean;
3471
3913
 
3472
- protected static override get _defaults(): StringFieldOptions;
3914
+ protected static override get _defaults(): StringField.Options;
3473
3915
 
3474
3916
  // These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
3917
+ /** @remarks Sets `groupConfig.stacked ??= true` before calling super */
3475
3918
  toFormGroup(
3476
3919
  groupConfig?: HTMLField.GroupConfig,
3477
3920
  inputConfig?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
@@ -3497,7 +3940,7 @@ declare class HTMLField<
3497
3940
  }
3498
3941
 
3499
3942
  declare namespace HTMLField {
3500
- /** The type of the default options for the {@link HTMLField} class. */
3943
+ /** The type of the default options for the {@link HTMLField | `HTMLField`} class. */
3501
3944
  type DefaultOptions = SimpleMerge<
3502
3945
  StringField.DefaultOptions,
3503
3946
  {
@@ -3510,13 +3953,13 @@ declare namespace HTMLField {
3510
3953
  * A helper type for the given options type merged into the default options of the HTMLField class.
3511
3954
  * @typeParam Options - the options that override the default options
3512
3955
  */
3513
- type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
3956
+ type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
3514
3957
 
3515
3958
  /**
3516
3959
  * A shorthand for the assignment type of a HTMLField class.
3517
3960
  * @typeParam Options - the options that override the default options
3518
3961
  */
3519
- type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
3962
+ type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
3520
3963
  string,
3521
3964
  MergedOptions<Options>
3522
3965
  >;
@@ -3525,7 +3968,7 @@ declare namespace HTMLField {
3525
3968
  * A shorthand for the initialized type of a HTMLField class.
3526
3969
  * @typeParam Options - the options that override the default options
3527
3970
  */
3528
- type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
3971
+ type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
3529
3972
  string,
3530
3973
  MergedOptions<Options>
3531
3974
  >;
@@ -3535,20 +3978,20 @@ declare namespace HTMLField {
3535
3978
  }
3536
3979
 
3537
3980
  /**
3538
- * A subclass of {@link NumberField} which is used for storing integer sort keys.
3981
+ * A subclass of {@link NumberField | `NumberField`} which is used for storing integer sort keys.
3539
3982
  * @typeParam Options - the options of the IntegerSortField instance
3540
3983
  * @typeParam AssignmentType - the type of the allowed assignment values of the IntegerSortField
3541
3984
  * @typeParam InitializedType - the type of the initialized values of the IntegerSortField
3542
3985
  * @typeParam PersistedType - the type of the persisted values of the IntegerSortField
3543
3986
  * @remarks
3544
3987
  * Defaults:
3545
- * AssignmentType: `number | null | undefined`
3546
- * InitializedType: `number`
3547
- * PersistedType: `number`
3548
- * InitialValue: `0`
3988
+ * - AssignmentType: `number | null | undefined`
3989
+ * - InitializedType: `number`
3990
+ * - PersistedType: `number`
3991
+ * - InitialValue: `0`
3549
3992
  */
3550
3993
  declare class IntegerSortField<
3551
- Options extends NumberFieldOptions = IntegerSortField.DefaultOptions,
3994
+ Options extends NumberField.Options = IntegerSortField.DefaultOptions,
3552
3995
  AssignmentType = IntegerSortField.AssignmentType<Options>,
3553
3996
  InitializedType = IntegerSortField.InitializedType<Options>,
3554
3997
  PersistedType extends number | null | undefined = IntegerSortField.InitializedType<Options>,
@@ -3563,19 +4006,21 @@ declare class IntegerSortField<
3563
4006
  override integer: boolean;
3564
4007
 
3565
4008
  /** @defaultValue `0` */
3566
- override initial: DataFieldOptions.InitialType<InitializedType>;
4009
+ override initial: DataField.Options.InitialType<InitializedType>;
3567
4010
 
3568
4011
  /** @defaultValue `"FOLDER.DocumentSort"` */
3569
4012
  override label: string;
3570
4013
 
3571
4014
  /** @defaultValue `"FOLDER.DocumentSortHint"` */
3572
4015
  override hint: string;
4016
+
4017
+ static override get _defaults(): NumberField.Options;
3573
4018
  }
3574
4019
 
3575
4020
  declare namespace IntegerSortField {
3576
- /** The type of the default options for the {@link IntegerSortField} class. */
4021
+ /** The type of the default options for the {@link IntegerSortField | `IntegerSortField`} class. */
3577
4022
  type DefaultOptions = SimpleMerge<
3578
- DataField.DefaultOptions,
4023
+ NumberField.DefaultOptions,
3579
4024
  {
3580
4025
  required: true;
3581
4026
  nullable: false;
@@ -3590,13 +4035,13 @@ declare namespace IntegerSortField {
3590
4035
  * A helper type for the given options type merged into the default options of the IntegerSortField class.
3591
4036
  * @typeParam Options - the options that override the default options
3592
4037
  */
3593
- type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
4038
+ type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
3594
4039
 
3595
4040
  /**
3596
4041
  * A shorthand for the assignment type of a IntegerSortField class.
3597
4042
  * @typeParam Options - the options that override the default options
3598
4043
  */
3599
- type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
4044
+ type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
3600
4045
  number,
3601
4046
  MergedOptions<Options>
3602
4047
  >;
@@ -3605,28 +4050,24 @@ declare namespace IntegerSortField {
3605
4050
  * A shorthand for the initialized type of a IntegerSortField class.
3606
4051
  * @typeParam Options - the options that override the default options
3607
4052
  */
3608
- type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
4053
+ type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
3609
4054
  number,
3610
4055
  MergedOptions<Options>
3611
4056
  >;
3612
4057
  }
3613
4058
 
3614
- declare global {
3615
- type DocumentStats = DocumentStatsField.Properties;
3616
- }
3617
-
3618
4059
  /**
3619
- * A subclass of {@link SchemaField} which stores document metadata in the _stats field.
4060
+ * A subclass of {@link SchemaField | `SchemaField`} which stores document metadata in the _stats field.
3620
4061
  * @typeParam Options - the options of the DocumentStatsField instance
3621
4062
  * @typeParam AssignmentType - the type of the allowed assignment values of the DocumentStatsField
3622
4063
  * @typeParam InitializedType - the type of the initialized values of the DocumentStatsField
3623
4064
  * @typeParam PersistedType - the type of the persisted values of the DocumentStatsField
3624
4065
  * @remarks
3625
4066
  * Defaults:
3626
- * AssignmentType: `Partial<DocumentStats> | null | undefined`
3627
- * InitializedType: `DocumentStats`
3628
- * PersistedType: `object`
3629
- * InitialValue:
4067
+ * - AssignmentType: `Partial<DocumentStats> | null | undefined`
4068
+ * - InitializedType: `DocumentStats`
4069
+ * - PersistedType: `object`
4070
+ * - InitialValue:
3630
4071
  * ```typescript
3631
4072
  * {
3632
4073
  * systemId: null,
@@ -3644,18 +4085,58 @@ declare class DocumentStatsField<
3644
4085
  InitializedType = DocumentStatsField.InitializedType<Options>,
3645
4086
  PersistedType extends AnyObject | null | undefined = DocumentStatsField.PersistedType<Options>,
3646
4087
  > extends SchemaField<DocumentStatsField.Schema, Options, AssignmentType, InitializedType, PersistedType> {
3647
- constructor(options?: Options);
4088
+ /**
4089
+ * @param options - Options which configure the behavior of the field
4090
+ * @param context - Additional context which describes the field
4091
+ */
4092
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
4093
+ constructor(options?: Options, context?: DataField.ConstructionContext);
4094
+
4095
+ /**
4096
+ * All Document stats.
4097
+ * @defaultValue
4098
+ * ```js
4099
+ * [
4100
+ * "coreVersion",
4101
+ * "systemId",
4102
+ * "systemVersion",
4103
+ * "createdTime",
4104
+ * "modifiedTime",
4105
+ * "lastModifiedBy",
4106
+ * "compendiumSource",
4107
+ * "duplicateSource"
4108
+ * ]
4109
+ * ```
4110
+ */
4111
+ static fields: string[];
4112
+
4113
+ /**
4114
+ * These fields are managed by the server and are ignored if they appear in creation or update data.
4115
+ * @defaultValue
4116
+ * ```js
4117
+ * [
4118
+ * "coreVersion",
4119
+ * "systemId",
4120
+ * "systemVersion",
4121
+ * "createdTime",
4122
+ * "modifiedTime",
4123
+ * "lastModifiedBy",
4124
+ * ]
4125
+ * ```
4126
+ * @remarks The only fields not managed are `compendiumSource` and `duplicateSource`
4127
+ */
4128
+ static managedFields: string[];
3648
4129
  }
3649
4130
 
3650
4131
  declare namespace DocumentStatsField {
3651
4132
  /** A shorthand for the options of a DocumentStatsField class. */
3652
- type Options = DataFieldOptions<SchemaField.InnerAssignmentType<Schema>>;
4133
+ type Options = DataField.Options<SchemaField.AssignmentData<Schema>>;
3653
4134
 
3654
- /** The type of the default options for the {@link DocumentStatsField} class. */
3655
- type DefaultOptions = SimpleMerge<SchemaField.DefaultOptions, { initial: SchemaField.InnerAssignmentType<Schema> }>;
4135
+ /** The type of the default options for the {@link DocumentStatsField | `DocumentStatsField`} class. */
4136
+ type DefaultOptions = SimpleMerge<SchemaField.DefaultOptions, { initial: SchemaField.AssignmentData<Schema> }>;
3656
4137
 
3657
4138
  /**
3658
- * A helper type for the given options type merged into the default options of the {@link DocumentStatsField} class.
4139
+ * A helper type for the given options type merged into the default options of the {@link DocumentStatsField | `DocumentStatsField`} class.
3659
4140
  * @typeParam Opts - the options that override the default options
3660
4141
  */
3661
4142
  type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
@@ -3665,7 +4146,7 @@ declare namespace DocumentStatsField {
3665
4146
  * @typeParam Opts - the options that override the default options
3666
4147
  */
3667
4148
  type AssignmentType<Opts extends Options = DefaultOptions> = DataField.DerivedAssignmentType<
3668
- SchemaField.InnerAssignmentType<Schema>,
4149
+ SchemaField.AssignmentData<Schema>,
3669
4150
  MergedOptions<Opts>
3670
4151
  >;
3671
4152
 
@@ -3674,7 +4155,7 @@ declare namespace DocumentStatsField {
3674
4155
  * @typeParam Opts - the options that override the default options
3675
4156
  */
3676
4157
  type InitializedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
3677
- SchemaField.InnerInitializedType<Schema>,
4158
+ SchemaField.InitializedData<Schema>,
3678
4159
  MergedOptions<Opts>
3679
4160
  >;
3680
4161
 
@@ -3683,13 +4164,24 @@ declare namespace DocumentStatsField {
3683
4164
  * @typeParam Opts - the options that override the default options
3684
4165
  */
3685
4166
  type PersistedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
3686
- SchemaField.InnerPersistedType<Schema>,
4167
+ SchemaField.SourceData<Schema>,
3687
4168
  MergedOptions<Opts>
3688
4169
  >;
3689
4170
 
3690
- type ConstructorData = SchemaField.InnerConstructorType<Schema>;
3691
- type Properties = SchemaField.InnerInitializedType<Schema>;
3692
- type Source = SchemaField.InnerPersistedType<Schema>;
4171
+ interface CreateData extends SchemaField.CreateData<Schema> {}
4172
+
4173
+ interface InitializedData extends SchemaField.InitializedData<Schema> {}
4174
+
4175
+ interface SourceData extends SchemaField.SourceData<Schema> {}
4176
+
4177
+ /** @deprecated {@link DocumentStatsField.CreateData | `DocumentStatsField.CreateData`} */
4178
+ type ConstructorData = CreateData;
4179
+
4180
+ /** @deprecated {@link DocumentStatsField.InitializedData | `DocumentStatsField.InitializedData`} */
4181
+ type Properties = SchemaField.InitializedData<Schema>;
4182
+
4183
+ /** @deprecated {@link DocumentStatsField.SourceData | `DocumentStatsField.SourceData`} */
4184
+ type Source = SchemaField.SourceData<Schema>;
3693
4185
 
3694
4186
  interface Schema extends DataSchema {
3695
4187
  /**
@@ -3734,7 +4226,7 @@ declare namespace DocumentStatsField {
3734
4226
  }
3735
4227
 
3736
4228
  /**
3737
- * A subclass of [StringField]{@link StringField} that is used specifically for the Document "type" field.
4229
+ * A subclass of {@link StringField | `StringField`} that is used specifically for the Document "type" field.
3738
4230
  */
3739
4231
  declare class DocumentTypeField<
3740
4232
  const ConcreteDocumentClass extends Document.AnyConstructor,
@@ -3755,19 +4247,26 @@ declare class DocumentTypeField<
3755
4247
  * @param documentClass - The base document class which belongs in this field
3756
4248
  * @param options - Options which configure the behavior of the field
3757
4249
  * @param context - Additional context which describes the field
4250
+ * @remarks Enforces `choices` being `documentClass.TYPES`
3758
4251
  */
3759
- constructor(documentClass: ConcreteDocumentClass, options: DocumentTypeField.Options, context?: DataField.Context);
4252
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
4253
+ constructor(
4254
+ documentClass: ConcreteDocumentClass,
4255
+ options?: DocumentTypeField.Options,
4256
+ context?: DataField.ConstructionContext,
4257
+ );
3760
4258
 
3761
4259
  static override get _defaults(): DocumentTypeField.Options;
3762
4260
 
4261
+ /** @remarks `options` is required as it has no default handling and its `fallback` property is accessed */
3763
4262
  protected override _validateType(
3764
4263
  value: InitializedType,
3765
- options?: DataField.ValidationOptions<DataField.Any>,
4264
+ options: DataField.ValidateOptions<this>,
3766
4265
  ): boolean | DataModelValidationFailure | void;
3767
4266
  }
3768
4267
 
3769
4268
  declare namespace DocumentTypeField {
3770
- /** The type of the default options for the {@link DocumentTypeField} class. */
4269
+ /** The type of the default options for the {@link DocumentTypeField | `DocumentTypeField`} class. */
3771
4270
  type DefaultOptions = SimpleMerge<
3772
4271
  StringField.DefaultOptions,
3773
4272
  {
@@ -3777,12 +4276,12 @@ declare namespace DocumentTypeField {
3777
4276
  }
3778
4277
  >;
3779
4278
 
3780
- interface Options extends StringFieldOptions {}
4279
+ interface Options extends StringField.Options {}
3781
4280
 
3782
4281
  // TODO(LukeAbby): This class has effectively removed `choices` and `validationError` since they're unconditionally set in the constructor.
3783
4282
  type MergedOptions<
3784
4283
  ConcreteDocumentClass extends Document.AnyConstructor,
3785
- Options extends StringFieldOptions,
4284
+ Options extends StringField.Options,
3786
4285
  > = SimpleMerge<
3787
4286
  SimpleMerge<DefaultOptions, Options>,
3788
4287
  {
@@ -3793,20 +4292,20 @@ declare namespace DocumentTypeField {
3793
4292
 
3794
4293
  type AssignmentType<
3795
4294
  ConcreteDocumentClass extends Document.AnyConstructor,
3796
- Options extends StringFieldOptions,
4295
+ Options extends StringField.Options,
3797
4296
  > = StringField.AssignmentType<MergedOptions<ConcreteDocumentClass, Options>>;
3798
4297
  type InitializedType<
3799
4298
  ConcreteDocumentClass extends Document.AnyConstructor,
3800
- Options extends StringFieldOptions,
4299
+ Options extends StringField.Options,
3801
4300
  > = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
3802
4301
  type PersistedType<
3803
4302
  ConcreteDocumentClass extends Document.AnyConstructor,
3804
- Options extends StringFieldOptions,
4303
+ Options extends StringField.Options,
3805
4304
  > = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
3806
4305
  }
3807
4306
 
3808
4307
  /**
3809
- * A subclass of [ObjectField]{@link ObjectField} which supports a type-specific data object.
4308
+ * A subclass of {@link ObjectField | `ObjectField`} which supports a type-specific data object.
3810
4309
  * @typeParam DocumentType - the type of the embedded Document
3811
4310
  * @typeParam Options - the options of the TypeDataField instance
3812
4311
  * @typeParam AssignmentType - the type of the allowed assignment values of the TypeDataField
@@ -3814,10 +4313,10 @@ declare namespace DocumentTypeField {
3814
4313
  * @typeParam PersistedType - the type of the persisted values of the TypeDataField
3815
4314
  * @remarks
3816
4315
  * Defaults:
3817
- * AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
3818
- * InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]>`
3819
- * PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]>`
3820
- * InitialValue: `{}`
4316
+ * - AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
4317
+ * - InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]>`
4318
+ * - PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]>`
4319
+ * - InitialValue: `{}`
3821
4320
  */
3822
4321
  declare class TypeDataField<
3823
4322
  const SystemDocument extends Document.SystemConstructor,
@@ -3829,8 +4328,10 @@ declare class TypeDataField<
3829
4328
  /**
3830
4329
  * @param document - The base document class which belongs in this field
3831
4330
  * @param options - Options which configure the behavior of the field
4331
+ * @param context - Additional context which describes the field
3832
4332
  */
3833
- constructor(document: SystemDocument, options?: Options);
4333
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
4334
+ constructor(document: SystemDocument, options?: Options, context?: DataField.ConstructionContext);
3834
4335
 
3835
4336
  /** @defaultValue `true` */
3836
4337
  override required: boolean;
@@ -3863,22 +4364,34 @@ declare class TypeDataField<
3863
4364
  */
3864
4365
  getModelForType(type: string): DataModel.AnyConstructor | null;
3865
4366
 
3866
- override getInitialValue(data: { type?: string }): InitializedType;
4367
+ /** @remarks If an object with a valid `type` isn't passed, returns `{}` */
4368
+ override getInitialValue(data?: { type?: string }): InitializedType;
3867
4369
 
3868
- protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
4370
+ /**
4371
+ * @remarks Returns:
4372
+ * - If a valid TypeDataModel, the `value` run through its `.cleanData` with `options.source: value`, else
4373
+ * - If `options.partial`, simply `value`, else
4374
+ * - A `mergeObject` of `this.getInitialValue(options.source)` and `value`
4375
+ *
4376
+ * `options` is required as it lacks any default handling and has its properties accessed
4377
+ */
4378
+ protected override _cleanType(value: InitializedType, options: DataField.CleanOptions): InitializedType;
3869
4379
 
4380
+ // options: not null (parameter default only)
3870
4381
  override initialize(
3871
4382
  value: PersistedType,
3872
4383
  model: DataModel.Any,
3873
- options?: AnyObject,
4384
+ options?: DataField.InitializeOptions,
3874
4385
  ): InitializedType | (() => InitializedType | null);
3875
4386
 
4387
+ // options: not null (parameter default only, property access)
3876
4388
  protected override _validateType(
3877
4389
  value: InitializedType,
3878
- options?: DataField.ValidationOptions<DataField.Any>,
4390
+ options?: DataField.ValidateOptions<this>,
3879
4391
  ): boolean | DataModelValidationFailure | void;
3880
4392
 
3881
- protected override _validateModel(data: AnyObject, options?: AnyObject): void;
4393
+ // options: not ull (parameter default only, property access)
4394
+ protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
3882
4395
 
3883
4396
  override toObject(value: InitializedType): PersistedType;
3884
4397
 
@@ -3895,11 +4408,11 @@ declare namespace TypeDataField {
3895
4408
  * A shorthand for the options of a TypeDataField class.
3896
4409
  * @typeParam DocumentType - the type of the embedded Document
3897
4410
  */
3898
- type Options<DocumentType extends Document.SystemConstructor> = DataFieldOptions<
3899
- SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>>
4411
+ type Options<DocumentType extends Document.SystemConstructor> = DataField.Options<
4412
+ SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>>
3900
4413
  >;
3901
4414
 
3902
- /** The type of the default options for the {@link TypeDataField} class. */
4415
+ /** The type of the default options for the {@link TypeDataField | `TypeDataField`} class. */
3903
4416
  type DefaultOptions = SimpleMerge<
3904
4417
  ObjectField.DefaultOptions,
3905
4418
  {
@@ -3917,73 +4430,10 @@ declare namespace TypeDataField {
3917
4430
  Opts
3918
4431
  >;
3919
4432
 
3920
- /**
3921
- * Get the system DataModel configuration for a specific document type.
3922
- * @typeParam DocumentType - the type of the Document this system data is for
3923
- *
3924
- * @deprecated - This helper is from a time where {@link DataModelConfig | `DataModelConfig`}
3925
- * was still recommended to use instances. This will always return instances but
3926
- * its name is now misleading. For a replacement see {@link DataModelInstances | `DataModelInstances`}.
3927
- * If you want to get the class see {@link DataModelClasses | `DataModelClasses`}.
3928
- */
3929
- type Config<DocumentType extends Document.SystemConstructor> = DataModelInstances<DocumentType["metadata"]["name"]>;
3930
-
3931
- type DataModelInstances<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
3932
- ? _ToInstances<DataModelConfig[DocumentType]>
3933
- : EmptyObject;
3934
-
3935
- /**
3936
- * @internal
3937
- */
3938
- type _ToInstances<T extends AnyObject> = {
3939
- [K in keyof T]: T[K] extends AnyConstructor ? InstanceType<T[K]> : T[K];
3940
- };
3941
-
3942
- type DataModelClasses<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
3943
- ? _ToClasses<DataModelConfig[DocumentType]>
4433
+ type DataModelsFor<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
4434
+ ? DataModelConfig[DocumentType]
3944
4435
  : EmptyObject;
3945
4436
 
3946
- /**
3947
- * @internal
3948
- */
3949
- type _ToClasses<T extends AnyObject> = {
3950
- [K in keyof T]: _ToClass<T[K]>;
3951
- };
3952
-
3953
- /**
3954
- * @internal
3955
- * This method must go from an instance to a static side we know nothing about.
3956
- * This means its inherently lossy and full of assumptions.
3957
- * This is to support old configuration styles relatively gracefully.
3958
- */
3959
- type _ToClass<T> = T extends AnyConstructor
3960
- ? T
3961
- : T extends TypeDataModel<infer Schema, infer Parent, infer BaseData, infer DerivedData>
3962
- ? TypeDataModel.ConfigurationFailureClass &
3963
- (abstract new (...args: any[]) => T) &
3964
- typeof TypeDataModel<Schema, Parent, BaseData, DerivedData>
3965
- : T extends DataModel<infer Schema, infer Parent, infer ExtraConstructorOptions>
3966
- ? TypeDataModel.ConfigurationFailureClass &
3967
- (abstract new (...args: any[]) => T) &
3968
- typeof DataModel<Schema, Parent, ExtraConstructorOptions>
3969
- : TypeDataModel.ConfigurationFailureClass;
3970
-
3971
- /**
3972
- * Get the configured core and system type names for a specific document type.
3973
- * @typeParam ConcreteDocument - the type of the Document this data is for
3974
- * @deprecated Use the Game.Model namespace instead of TypeDataField
3975
- */
3976
- type TypeNames<ConcreteDocument extends Document.SystemConstructor> = Game.Model.TypeNames<
3977
- ConcreteDocument["metadata"]["name"]
3978
- >;
3979
-
3980
- /**
3981
- * Get the core type names for a specific document type.
3982
- * @typeParam DocumentType - the type of the Document this data is for
3983
- * @deprecated Use `DocumentType["metadata"]["coreTypes"][number]`
3984
- */
3985
- type CoreTypeNames<DocumentType extends Document.SystemConstructor> = DocumentType["metadata"]["coreTypes"][number];
3986
-
3987
4437
  /**
3988
4438
  * A shorthand for the assignment type of a TypeDataField class.
3989
4439
  * @typeParam DocumentType - the type of the embedded Document
@@ -3991,8 +4441,8 @@ declare namespace TypeDataField {
3991
4441
  */
3992
4442
  type AssignmentType<
3993
4443
  SystemDocumentConstructor extends Document.SystemConstructor,
3994
- Opts extends Options<InstanceType<SystemDocumentConstructor>>,
3995
- > = DataField.DerivedAssignmentType<AnyObject, MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>>;
4444
+ Opts extends Options<SystemDocumentConstructor>,
4445
+ > = DataField.DerivedAssignmentType<AnyObject, MergedOptions<SystemDocumentConstructor, Opts>>;
3996
4446
 
3997
4447
  /**
3998
4448
  * A shorthand for the initialized type of a TypeDataField class.
@@ -4001,23 +4451,16 @@ declare namespace TypeDataField {
4001
4451
  */
4002
4452
  type InitializedType<
4003
4453
  SystemDocumentConstructor extends Document.SystemConstructor,
4004
- Opts extends Options<InstanceType<SystemDocumentConstructor>>,
4454
+ Opts extends Options<SystemDocumentConstructor>,
4005
4455
  > = DataField.DerivedInitializedType<
4006
- ValueOf<DataModelInstances<SystemDocumentConstructor["metadata"]["name"]>> | UnknownSystem,
4007
- MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>
4456
+ _Instances<DataModelsFor<SystemDocumentConstructor["metadata"]["name"]>> | Document.UnknownSystem,
4457
+ MergedOptions<SystemDocumentConstructor, Opts>
4008
4458
  >;
4009
4459
 
4010
- /**
4011
- * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
4012
- * A module can provide its own custom type though it is always of the form `${moduleName}.${subType}` so the `.` is a pretty
4013
- * strong indicator.
4014
- *
4015
- * `UnknownSourceData` covers the case where it's configured without a data model.
4016
- * See {@link UnknownSystem | `UnknownSystem`} for other possibilities.
4017
- */
4018
- interface UnknownSourceData extends AnyObject {
4019
- type: `${string}.${string}`;
4020
- }
4460
+ /** @internal */
4461
+ type _Instances<T> = {
4462
+ [K in keyof T]: T[K] extends (abstract new (...args: never) => infer U extends DataModel.Any) ? U : never;
4463
+ }[keyof T];
4021
4464
 
4022
4465
  /**
4023
4466
  * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
@@ -4029,83 +4472,85 @@ declare namespace TypeDataField {
4029
4472
  */
4030
4473
  interface UnknownTypeDataModel extends TypeDataModel<any, any, any, any> {}
4031
4474
 
4032
- /**
4033
- * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
4034
- *
4035
- * `UnknownDataModel` covers the case where it's configured with a {@link DataModel | `DataModel`}.
4036
- * Using a {@link TypeDataModel | `TypeDataModel`} is recommended by Foundry but a {@link DataModel | `DataModel`} is
4037
- * always possible.
4038
- * See {@link UnknownSystem | `UnknownSystem`} for other possibilities.
4039
- */
4040
- interface UnknownDataModel extends DataModel<any, any, any> {}
4041
-
4042
- /**
4043
- * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
4044
- */
4045
- type UnknownSystem = UnknownSourceData | UnknownTypeDataModel | UnknownDataModel;
4046
-
4047
4475
  /**
4048
4476
  * A shorthand for the persisted type of a TypeDataField class.
4049
4477
  * @typeParam DocumentType - the type of the embedded Document
4050
4478
  * @typeParam Opts - the options that override the default options
4051
4479
  */
4052
4480
  type PersistedType<
4053
- SystemDocumentConstructor extends Document.SystemConstructor,
4054
- Opts extends Options<InstanceType<SystemDocumentConstructor>>,
4055
- > = DataField.DerivedInitializedType<AnyObject, MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>>;
4481
+ ConcreteDocument extends Document.SystemConstructor,
4482
+ Opts extends Options<ConcreteDocument>,
4483
+ > = DataField.DerivedInitializedType<AnyObject, MergedOptions<ConcreteDocument, Opts>>;
4056
4484
  }
4057
4485
 
4058
4486
  /**
4059
- * A subclass of [DataField]{@link DataField} which allows to typed schemas.
4487
+ * A subclass of {@link DataField | `DataField`} which allows to typed schemas.
4060
4488
  */
4061
4489
  declare class TypedSchemaField<
4062
4490
  const Types extends TypedSchemaField.Types,
4063
- const Options extends TypedSchemaField.DefaultOptions = TypedSchemaField.DefaultOptions,
4491
+ const Options extends TypedSchemaField.Options<Types> = TypedSchemaField.DefaultOptions,
4064
4492
  const AssignmentType = TypedSchemaField.AssignmentType<Types, Options>,
4065
4493
  const InitializedType = TypedSchemaField.InitializedType<Types, Options>,
4066
- const PersistedType extends unknown | null | undefined = TypedSchemaField.PersistedType<Types, Options>,
4494
+ const PersistedType = TypedSchemaField.PersistedType<Types, Options>,
4067
4495
  > extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
4068
4496
  /**
4069
4497
  * @param types - The different types this field can represent.
4070
4498
  * @param options - Options which configure the behavior of the field
4071
4499
  * @param context - Additional context which describes the field
4072
4500
  */
4073
- constructor(types: Types, options: Options, context?: DataField.Context);
4501
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
4502
+ constructor(types: Types, options?: Options, context?: DataField.ConstructionContext);
4074
4503
 
4075
- static get _defaults(): DataFieldOptions.Any;
4504
+ static get _defaults(): DataField.Options.Any;
4076
4505
 
4077
4506
  /**
4078
4507
  * The types of this field.
4079
4508
  */
4080
4509
  types: TypedSchemaField.ToConfiguredTypes<Types>;
4081
4510
 
4082
- protected override _getField(path: string[]): unknown;
4511
+ protected override _getField(path: string[]): DataField.Any;
4083
4512
 
4513
+ /**
4514
+ * @remarks Returns `value` if `value?.type` doesn't map to a valid type, otherwise it runs `value`
4515
+ * through the matching type's `#clean`
4516
+ */
4517
+ // options: not null (parameter default only, property access in super)
4084
4518
  protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
4085
4519
 
4086
4520
  protected override _cast(value: AssignmentType): InitializedType;
4087
4521
 
4088
4522
  protected override _validateSpecial(value: AssignmentType): boolean | void;
4089
4523
 
4524
+ /** @remarks Forwards to the SchemaField designated by `value.type`'s `#validate` */
4525
+ // options: not null (parameter default only, property access in super)
4090
4526
  protected override _validateType(
4091
4527
  value: InitializedType,
4092
- options?: DataField.ValidationOptions<DataField.Any>,
4528
+ options?: DataField.ValidateOptions<this>,
4093
4529
  ): boolean | DataModelValidationFailure | void;
4094
4530
 
4531
+ // options: not null (parameter default only)
4095
4532
  override initialize(
4096
4533
  value: PersistedType,
4097
4534
  model: DataModel.Any,
4098
- options?: AnyObject, // TODO: Type further.
4099
- ): (() => InitializedType | null) | InitializedType;
4535
+ options?: DataField.InitializeOptions,
4536
+ ): InitializedType | (() => InitializedType | null);
4100
4537
 
4101
4538
  override toObject(value: InitializedType): PersistedType;
4102
4539
 
4103
4540
  // TODO(LukeAbby): Type `TypedSchemaField#apply`.
4541
+ // options: not null (could be forwarded somewhere destructured, parameter default only)
4542
+ override apply<Options, Return>(
4543
+ fn: keyof this | ((this: this, value: AnyObject, options: Options) => Return),
4544
+ value?: AnyObject,
4545
+ options?: Options,
4546
+ ): Return;
4104
4547
 
4105
4548
  migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
4106
4549
  }
4107
4550
 
4108
4551
  declare namespace TypedSchemaField {
4552
+ interface Options<T extends Types> extends DataField.Options<_AssignmentType<ToConfiguredTypes<T>>> {}
4553
+
4109
4554
  type DefaultOptions = SimpleMerge<
4110
4555
  DataField.DefaultOptions,
4111
4556
  {
@@ -4113,31 +4558,36 @@ declare namespace TypedSchemaField {
4113
4558
  }
4114
4559
  >;
4115
4560
 
4116
- type ValidField = DataField<
4117
- {
4118
- required: true;
4119
- nullable: false;
4120
- },
4121
- any,
4122
- any,
4123
- any
4124
- >;
4125
-
4561
+ /**
4562
+ * A `ValidDataSchema` must pass the checks in `#configureTypes`. Namely:
4563
+ * - No `name` property.
4564
+ * - No `parent`.
4565
+ *
4566
+ * Additionally the `type` property (if any):
4567
+ * - Must be a `StringField`.
4568
+ * - Must be `required`
4569
+ * - Must not be `nullable`.
4570
+ * - Must not be `blank`.
4571
+ * - Must allow the corresponding type as a valid value.
4572
+ */
4126
4573
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
4127
4574
  type ValidDataSchema = {
4128
- readonly [field: string]: ValidField;
4575
+ readonly [field: string]: DataField.Any;
4129
4576
  };
4130
4577
 
4131
4578
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
4132
4579
  type Types = {
4133
4580
  [type: string]:
4134
4581
  | ValidDataSchema
4135
- | SchemaField<ValidDataSchema, any, any, any, any>
4136
- | typeof DataModel<ValidDataSchema, any>;
4582
+ | SchemaField<DataSchema, { required: true; nullable: false }, any, any, any>
4583
+ | typeof DataModel<DataSchema, null>;
4137
4584
  };
4138
4585
 
4139
4586
  type ToConfiguredTypes<Types extends TypedSchemaField.Types> = {
4140
- [K in keyof Types]: Types[K] extends DataModel.AnyConstructor ? EmbeddedDataField<Types[K]> : never;
4587
+ [K in keyof Types]:
4588
+ | (Types[K] extends ValidDataSchema ? SchemaField<Types[K]> : never)
4589
+ | (Types[K] extends SchemaField.Any ? Types[K] : never)
4590
+ | (Types[K] extends DataModel.AnyConstructor ? EmbeddedDataField<Types[K]> : never);
4141
4591
  };
4142
4592
 
4143
4593
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -4149,44 +4599,45 @@ declare namespace TypedSchemaField {
4149
4599
  * @internal
4150
4600
  */
4151
4601
  type _AssignmentType<Types extends ConfiguredTypes> = {
4152
- [K in keyof Types]: DataField.AssignmentTypeFor<Types[K]>;
4602
+ [K in keyof Types]: DataField.AssignmentTypeFor<Types[K]> & { type: K };
4153
4603
  }[keyof Types];
4154
4604
 
4155
4605
  type AssignmentType<
4156
4606
  Types extends TypedSchemaField.Types,
4157
- Options extends TypedSchemaField.DefaultOptions,
4607
+ Options extends TypedSchemaField.Options<Types>,
4158
4608
  > = DataField.DerivedAssignmentType<_AssignmentType<ToConfiguredTypes<Types>>, Options>;
4159
4609
 
4160
4610
  /**
4161
4611
  * @internal
4162
4612
  */
4163
4613
  type _InitializedType<Types extends ConfiguredTypes> = {
4164
- [K in keyof Types]: DataField.InitializedTypeFor<Types[K]>;
4614
+ [K in keyof Types]: DataField.InitializedTypeFor<Types[K]> & { type: K };
4165
4615
  }[keyof Types];
4166
4616
 
4167
4617
  type InitializedType<
4168
4618
  Types extends TypedSchemaField.Types,
4169
- Options extends TypedSchemaField.DefaultOptions,
4619
+ Options extends TypedSchemaField.Options<Types>,
4170
4620
  > = DataField.DerivedInitializedType<_InitializedType<ToConfiguredTypes<Types>>, Options>;
4171
4621
 
4172
4622
  /**
4173
4623
  * @internal
4174
4624
  */
4175
4625
  type _PersistedType<Types extends ConfiguredTypes> = {
4176
- [K in keyof Types]: DataField.PersistedTypeFor<Types[K]>;
4626
+ [K in keyof Types]: DataField.PersistedTypeFor<Types[K]> & { type: K };
4177
4627
  }[keyof Types];
4178
4628
 
4179
4629
  type PersistedType<
4180
4630
  Types extends TypedSchemaField.Types,
4181
- _Options extends TypedSchemaField.DefaultOptions,
4182
- > = DataField.DerivedInitializedType<_PersistedType<ToConfiguredTypes<Types>>, _Options>;
4631
+ Options extends TypedSchemaField.Options<Types>,
4632
+ > = DataField.DerivedInitializedType<_PersistedType<ToConfiguredTypes<Types>>, Options>;
4183
4633
  }
4184
4634
 
4185
4635
  /**
4186
- * @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
4636
+ * @deprecated since v11 until v13; ModelValidationError is deprecated. Please use DataModelValidationError instead.
4187
4637
  * @typeParam Errors - the type of the errors contained in this error
4188
4638
  */
4189
4639
  declare class ModelValidationError<
4640
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
4190
4641
  Errors extends ModelValidationError.Errors = ModelValidationError.Errors,
4191
4642
  > extends Error {
4192
4643
  /**
@@ -4202,12 +4653,13 @@ declare class ModelValidationError<
4202
4653
  * @param errors - The raw error structure
4203
4654
  * @returns A formatted error message
4204
4655
  */
4656
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
4205
4657
  static formatErrors(errors: ModelValidationError.Errors): string;
4206
4658
  }
4207
4659
 
4208
4660
  declare namespace ModelValidationError {
4209
4661
  /**
4210
- * @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
4662
+ * @deprecated since v11 until v13; ModelValidationError is deprecated. Please use DataModelValidationError instead.
4211
4663
  */
4212
4664
  type Errors = Record<number | string | symbol, Error> | Error[] | string;
4213
4665
  }
@@ -4228,7 +4680,7 @@ declare class _InternalJavaScriptField<
4228
4680
  }
4229
4681
 
4230
4682
  /**
4231
- * A subclass of {@link StringField} which contains JavaScript code.
4683
+ * A subclass of {@link StringField | `StringField`} which contains JavaScript code.
4232
4684
  */
4233
4685
  declare class JavaScriptField<
4234
4686
  const Options extends JavaScriptField.Options = JavaScriptField.DefaultOptions,
@@ -4236,15 +4688,23 @@ declare class JavaScriptField<
4236
4688
  const InitializedType = StringField.InitializedType<Options>,
4237
4689
  const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
4238
4690
  > extends _InternalJavaScriptField<Options, AssignmentType, InitializedType, PersistedType> {
4239
- constructor(options?: Options, context?: DataField.Context);
4691
+ /**
4692
+ * @param options - Options which configure the behavior of the field
4693
+ * @param context - Additional context which describes the field
4694
+ * @remarks Enforces `choices = undefined`
4695
+ */
4696
+ // options: not null (unchecked `in` operation in super), context: not null (destructured in super)
4697
+ constructor(options?: Options, context?: DataField.ConstructionContext);
4240
4698
 
4241
4699
  static get _defaults(): JavaScriptField.Options;
4242
4700
 
4701
+ /** @remarks `options` is only passed to super, where it is unused in `StringField` */
4243
4702
  protected override _validateType(
4244
4703
  value: InitializedType,
4245
- options?: DataField.ValidationOptions<DataField.Any>,
4704
+ options?: DataField.ValidateOptions<this> | null,
4246
4705
  ): boolean | DataModelValidationFailure | void;
4247
4706
 
4707
+ /** @remarks Sets `groupConfig.stacked ??= true` then forwards to super */
4248
4708
  override toFormGroup(
4249
4709
  groupConfig?: JavaScriptField.GroupConfig,
4250
4710
  inputConfig?: JavaScriptField.ToInputConfig<InitializedType>,
@@ -4255,7 +4715,7 @@ declare class JavaScriptField<
4255
4715
 
4256
4716
  declare namespace JavaScriptField {
4257
4717
  // TODO(LukeAbby): `choices` is effectively deleted due to being unconditionally set to `undefined` in the constructor.
4258
- type Options = StringFieldOptions & {
4718
+ type Options = StringField.Options & {
4259
4719
  /**
4260
4720
  * Does the field allow async code?
4261
4721
  * @defaultValue `false`
@@ -4264,7 +4724,7 @@ declare namespace JavaScriptField {
4264
4724
  };
4265
4725
 
4266
4726
  type DefaultOptions = SimpleMerge<
4267
- StringFieldOptions,
4727
+ StringField.Options,
4268
4728
  {
4269
4729
  async: false;
4270
4730
  }