@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250705133313 → 13.346.0-beta.20250705222830
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
3
3
|
"name": "@league-of-foundry-developers/foundry-vtt-types",
|
4
|
-
"version": "13.346.0-beta.
|
4
|
+
"version": "13.346.0-beta.20250705222830",
|
5
5
|
"description": "TypeScript type definitions for Foundry VTT",
|
6
6
|
"type": "module",
|
7
7
|
"types": "./src/index.d.mts",
|
@@ -115,8 +115,8 @@
|
|
115
115
|
"jquery": "^3.7.1",
|
116
116
|
"mime-types": "^3.0.1",
|
117
117
|
"peggy": "^4.2.0",
|
118
|
-
"pixi.js": "github:foundry-vtt-types/pixi.js#main",
|
119
118
|
"pixi-basis-ktx2": "^0.0.22",
|
119
|
+
"pixi.js": "github:foundry-vtt-types/pixi.js#main",
|
120
120
|
"prosemirror-collab": "^1.3.1",
|
121
121
|
"prosemirror-commands": "^1.7.0",
|
122
122
|
"prosemirror-dropcursor": "^1.8.1",
|
@@ -170,6 +170,9 @@
|
|
170
170
|
"typescript-eslint": "^8.31.0",
|
171
171
|
"vitest": "^4.0.0-beta.1"
|
172
172
|
},
|
173
|
+
"overrides": {
|
174
|
+
"expect-type": "https://pkg.pr.new/mmkal/expect-type@7d6fa42"
|
175
|
+
},
|
173
176
|
"peerDependencies": {
|
174
177
|
"typescript": "^5.4"
|
175
178
|
},
|
@@ -1941,7 +1941,7 @@ declare global {
|
|
1941
1941
|
hudClass: foundry.applications.hud.TokenHUD.AnyConstructor;
|
1942
1942
|
|
1943
1943
|
/** @defaultValue `typeof TokenRuler` */
|
1944
|
-
rulerClass: foundry.canvas.placeables.tokens.TokenRuler;
|
1944
|
+
rulerClass: foundry.canvas.placeables.tokens.TokenRuler.AnyConstructor;
|
1945
1945
|
|
1946
1946
|
movement: {
|
1947
1947
|
/** @defaultValue `data.TerrainData` */
|
@@ -651,15 +651,16 @@ declare namespace DataField {
|
|
651
651
|
type DerivedAssignmentType<BaseAssignmentType, Options extends DataField.Options.Any> =
|
652
652
|
| Exclude<BaseAssignmentType, null | undefined> // Always include the base type
|
653
653
|
| (Options["nullable"] extends true // determine whether null is in the union
|
654
|
-
? // when nullable, null
|
655
|
-
null
|
654
|
+
? // when nullable, both `null` and `undefined` can safely be passed
|
655
|
+
null | undefined
|
656
656
|
: never)
|
657
657
|
| (Options["required"] extends true // determine whether undefined is in the union
|
658
658
|
? never
|
659
|
-
: // when not required, undefined can safely be passed
|
660
|
-
undefined)
|
659
|
+
: // when not required, both `null` and `undefined` can safely be passed
|
660
|
+
null | undefined)
|
661
661
|
| ("initial" extends keyof Options
|
662
|
-
?
|
662
|
+
? // TODO(LukeAbby): This should possibly actually be distributive.
|
663
|
+
Options["initial"] extends undefined
|
663
664
|
? never
|
664
665
|
: null | undefined // when initial is not `undefined` then `null | undefined` are valid.
|
665
666
|
: never);
|
@@ -1154,6 +1155,15 @@ declare namespace SchemaField {
|
|
1154
1155
|
*/
|
1155
1156
|
type MergedOptions<Fields extends DataSchema, Opts extends Options<Fields>> = SimpleMerge<DefaultOptions, Opts>;
|
1156
1157
|
|
1158
|
+
/**
|
1159
|
+
* @internal
|
1160
|
+
*/
|
1161
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
1162
|
+
type _EffectiveOptions<AssignmentData, Opts extends Options<any>> = [AssignmentData] extends [{}]
|
1163
|
+
? // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
1164
|
+
SimpleMerge<Opts, { initial: {} }> // If all fields are optional then the initial of `{}` is valid.
|
1165
|
+
: Opts;
|
1166
|
+
|
1157
1167
|
// These exist for calculating the type of schema field with options.
|
1158
1168
|
// This will be deleted once fields are refactored.
|
1159
1169
|
// The names are also confusing. Hence these it's put into `Internal.
|
@@ -1177,7 +1187,12 @@ declare namespace SchemaField {
|
|
1177
1187
|
Fields extends DataSchema,
|
1178
1188
|
Opts extends Options<Fields> = DefaultOptions,
|
1179
1189
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
1180
|
-
> = DataField.DerivedAssignmentType<
|
1190
|
+
> = DataField.DerivedAssignmentType<
|
1191
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
1192
|
+
AssignmentData<Fields>,
|
1193
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
1194
|
+
_EffectiveOptions<NonNullable<AssignmentData<Fields>>, MergedOptions<Fields, Opts>>
|
1195
|
+
>;
|
1181
1196
|
|
1182
1197
|
/**
|
1183
1198
|
* A shorthand for the assignment type of a SchemaField class.
|
@@ -1843,32 +1858,32 @@ declare namespace StringField {
|
|
1843
1858
|
type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<DefaultOptions, Options>;
|
1844
1859
|
|
1845
1860
|
/** @internal */
|
1846
|
-
type _EffectiveOptions<Options extends StringField.Options<unknown>> =
|
1847
|
-
|
1848
|
-
Options
|
1861
|
+
type _EffectiveOptions<Options extends StringField.Options<unknown>> = _OptionsForInitial<
|
1862
|
+
SimpleMerge<_OptionsForChoices<Options["choices"]>, MergedOptions<Options>>
|
1849
1863
|
>;
|
1850
1864
|
|
1851
1865
|
type _OptionsForChoices<Choices extends StringField.Options["choices"]> = undefined extends Choices
|
1852
1866
|
? DefaultOptions
|
1853
1867
|
: DefaultOptionsWhenChoicesProvided;
|
1854
1868
|
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1869
|
+
type _OptionsForInitial<Options extends StringField.Options<unknown>> = Options["initial"] extends undefined
|
1870
|
+
? SimpleMerge<
|
1871
|
+
Options,
|
1872
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
1873
|
+
{ initial: _InitialForOptions<Options> }
|
1874
|
+
>
|
1875
|
+
: Options;
|
1860
1876
|
|
1861
1877
|
/**
|
1862
1878
|
* @deprecated Foundry no longer directly modifies the options for `initial`, it uses `getInitialValue` for this purpose instead.
|
1863
1879
|
* @internal
|
1864
1880
|
*/
|
1865
|
-
type _InitialForOptions<Options extends StringField.Options<unknown>> =
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
: undefined;
|
1881
|
+
type _InitialForOptions<Options extends StringField.Options<unknown>> = [
|
1882
|
+
Options["blank"],
|
1883
|
+
Options["required"],
|
1884
|
+
] extends [true, true]
|
1885
|
+
? ""
|
1886
|
+
: undefined;
|
1872
1887
|
|
1873
1888
|
type ValidChoice<Options extends StringField.Options<unknown>> = _ValidChoice<Options["choices"]>;
|
1874
1889
|
|
@@ -2436,6 +2451,15 @@ declare namespace ArrayField {
|
|
2436
2451
|
*/
|
2437
2452
|
type MergedOptions<Opts extends AnyOptions> = SimpleMerge<DefaultOptions, Opts>;
|
2438
2453
|
|
2454
|
+
/**
|
2455
|
+
* @internal
|
2456
|
+
*/
|
2457
|
+
type _EffectiveOptions<Options extends AnyOptions> = Options["initial"] extends undefined
|
2458
|
+
? Options["min"] extends 0
|
2459
|
+
? SimpleMerge<Options, { initial: [] }>
|
2460
|
+
: Options // If `min` is set to anything but `0` the effective `initial` of `[]` is invalid.
|
2461
|
+
: Options;
|
2462
|
+
|
2439
2463
|
/**
|
2440
2464
|
* A type to infer the assignment element type of an ArrayField from its ElementFieldType.
|
2441
2465
|
* @template ElementFieldType - the DataField type of the elements in the ArrayField
|
@@ -2483,7 +2507,7 @@ declare namespace ArrayField {
|
|
2483
2507
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
2484
2508
|
type AssignmentType<AssignmentElementType, Opts extends AnyOptions> = DataField.DerivedAssignmentType<
|
2485
2509
|
BaseAssignmentType<AssignmentElementType>,
|
2486
|
-
MergedOptions<Opts
|
2510
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2487
2511
|
>;
|
2488
2512
|
|
2489
2513
|
/**
|
@@ -2494,7 +2518,7 @@ declare namespace ArrayField {
|
|
2494
2518
|
*/
|
2495
2519
|
type InitializedType<InitializedElementType, Opts extends AnyOptions> = DataField.DerivedInitializedType<
|
2496
2520
|
InitializedElementType[],
|
2497
|
-
MergedOptions<Opts
|
2521
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2498
2522
|
>;
|
2499
2523
|
|
2500
2524
|
/**
|
@@ -2505,7 +2529,7 @@ declare namespace ArrayField {
|
|
2505
2529
|
*/
|
2506
2530
|
type PersistedType<PersistedElementType, Opts extends AnyOptions> = DataField.DerivedInitializedType<
|
2507
2531
|
PersistedElementType[],
|
2508
|
-
MergedOptions<Opts
|
2532
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2509
2533
|
>;
|
2510
2534
|
}
|
2511
2535
|
|
@@ -2633,7 +2657,7 @@ declare namespace SetField {
|
|
2633
2657
|
type AssignmentType<AssignmentElementType, Opts extends AnyOptions> = DataField.DerivedAssignmentType<
|
2634
2658
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
2635
2659
|
BaseAssignmentType<AssignmentElementType>,
|
2636
|
-
MergedOptions<Opts
|
2660
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2637
2661
|
>;
|
2638
2662
|
|
2639
2663
|
/**
|
@@ -2644,7 +2668,7 @@ declare namespace SetField {
|
|
2644
2668
|
*/
|
2645
2669
|
type InitializedType<InitializedElementType, Opts extends AnyOptions> = DataField.DerivedInitializedType<
|
2646
2670
|
Set<InitializedElementType>,
|
2647
|
-
MergedOptions<Opts
|
2671
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2648
2672
|
>;
|
2649
2673
|
|
2650
2674
|
/**
|
@@ -2655,7 +2679,7 @@ declare namespace SetField {
|
|
2655
2679
|
*/
|
2656
2680
|
type PersistedType<PersistedElementType, Opts extends AnyOptions> = DataField.DerivedInitializedType<
|
2657
2681
|
PersistedElementType[],
|
2658
|
-
MergedOptions<Opts
|
2682
|
+
ArrayField._EffectiveOptions<MergedOptions<Opts>>
|
2659
2683
|
>;
|
2660
2684
|
|
2661
2685
|
type ToInputConfig<ElementFieldType extends DataField.Any, InitializedType> = ElementFieldType extends {
|
@@ -2767,11 +2791,7 @@ declare namespace EmbeddedDataField {
|
|
2767
2791
|
ModelType extends DataModel.AnyConstructor,
|
2768
2792
|
Opts extends Options<ModelType>,
|
2769
2793
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
2770
|
-
> =
|
2771
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
2772
|
-
SchemaField.AssignmentData<DataModel.SchemaOfClass<ModelType>>,
|
2773
|
-
MergedOptions<ModelType, Opts>
|
2774
|
-
>;
|
2794
|
+
> = SchemaField.Internal.AssignmentType<DataModel.SchemaOfClass<ModelType>, MergedOptions<ModelType, Opts>>;
|
2775
2795
|
|
2776
2796
|
/**
|
2777
2797
|
* A shorthand for the initialized type of an EmbeddedDataField class.
|
@@ -3018,10 +3038,7 @@ declare namespace EmbeddedCollectionField {
|
|
3018
3038
|
AssignmentElementType,
|
3019
3039
|
Opts extends Options<AssignmentElementType>,
|
3020
3040
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
3021
|
-
> =
|
3022
|
-
ArrayField.BaseAssignmentType<AssignmentElementType>,
|
3023
|
-
MergedOptions<AssignmentElementType, Opts>
|
3024
|
-
>;
|
3041
|
+
> = ArrayField.AssignmentType<AssignmentElementType, MergedOptions<AssignmentElementType, Opts>>;
|
3025
3042
|
|
3026
3043
|
/**
|
3027
3044
|
* A shorthand for the initialized type of an ArrayField class.
|
@@ -3185,7 +3202,7 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
3185
3202
|
AssignmentElementType,
|
3186
3203
|
Opts extends Options<AssignmentElementType>,
|
3187
3204
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
3188
|
-
> =
|
3205
|
+
> = ArrayField.AssignmentType<
|
3189
3206
|
ArrayField.BaseAssignmentType<AssignmentElementType>,
|
3190
3207
|
MergedOptions<AssignmentElementType, Opts>
|
3191
3208
|
>;
|
@@ -4486,19 +4503,13 @@ declare namespace HTMLField {
|
|
4486
4503
|
* for more details.
|
4487
4504
|
*/
|
4488
4505
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
4489
|
-
type AssignmentType<Options extends StringField.Options> =
|
4490
|
-
string,
|
4491
|
-
MergedOptions<Options>
|
4492
|
-
>;
|
4506
|
+
type AssignmentType<Options extends StringField.Options> = StringField.AssignmentType<MergedOptions<Options>>;
|
4493
4507
|
|
4494
4508
|
/**
|
4495
4509
|
* A shorthand for the initialized type of a HTMLField class.
|
4496
4510
|
* @template Options - the options that override the default options
|
4497
4511
|
*/
|
4498
|
-
type InitializedType<Options extends StringField.Options> =
|
4499
|
-
string,
|
4500
|
-
MergedOptions<Options>
|
4501
|
-
>;
|
4512
|
+
type InitializedType<Options extends StringField.Options> = StringField.InitializedType<MergedOptions<Options>>;
|
4502
4513
|
|
4503
4514
|
// `HTMLField#toFormGroup` provides a default by way of `groupConfig.stacked ??= true`.
|
4504
4515
|
interface GroupConfig extends Omit<DataField.GroupConfig, "stacked"> {
|
@@ -4630,15 +4641,14 @@ declare namespace DocumentFlagsField {
|
|
4630
4641
|
type AssignmentType<
|
4631
4642
|
Name extends Document.Type,
|
4632
4643
|
ExtensionFlags extends AnyObject,
|
4633
|
-
|
4634
|
-
|
4635
|
-
|
4636
|
-
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
|
4641
|
-
>;
|
4644
|
+
_Options extends DocumentFlagsField.Options,
|
4645
|
+
> =
|
4646
|
+
// Flags are currently always optional. At some point this will change.
|
4647
|
+
| _TwoLevelPartial<
|
4648
|
+
Document.Internal.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>
|
4649
|
+
>
|
4650
|
+
| null
|
4651
|
+
| undefined;
|
4642
4652
|
|
4643
4653
|
/**
|
4644
4654
|
* A shorthand for the initialized type of a IntegerSortField class.
|
@@ -5140,14 +5150,11 @@ declare namespace TypeDataField {
|
|
5140
5150
|
* @deprecated AssignmentType is being deprecated. See {@linkcode SchemaField.AssignmentData}
|
5141
5151
|
* for more details.
|
5142
5152
|
*/
|
5153
|
+
// Note(LukeAbby): Assumes `system` is always optional. This is overly optimistic.
|
5143
5154
|
type AssignmentType<
|
5144
5155
|
SystemDocumentConstructor extends Document.SystemConstructor,
|
5145
|
-
|
5146
|
-
|
5147
|
-
> = DataField.DerivedAssignmentType<
|
5148
|
-
_Schemas<DataModelsFor<SystemDocumentConstructor["metadata"]["name"]>>,
|
5149
|
-
MergedOptions<SystemDocumentConstructor, Opts>
|
5150
|
-
>;
|
5156
|
+
_Opts extends Options<SystemDocumentConstructor>,
|
5157
|
+
> = _Schemas<DataModelsFor<SystemDocumentConstructor["metadata"]["name"]>> | null | undefined;
|
5151
5158
|
|
5152
5159
|
/** @internal */
|
5153
5160
|
type _Schemas<T> = {
|
package/tsconfig.json
CHANGED
@@ -5,5 +5,5 @@
|
|
5
5
|
"include": ["**/*", ".*", ".**/**/*"],
|
6
6
|
// `src/index-lenient.d.mts` is skipped because it sets `AssumeHookRan` which has some pretty global effects that would make it easy to write broken code.
|
7
7
|
// `tests` are excluded to speed up typechecking.
|
8
|
-
"exclude": ["src/index-lenient.d.mts", "tests", "test"
|
8
|
+
"exclude": ["src/index-lenient.d.mts", "tests", "test"]
|
9
9
|
}
|