@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250708122847 → 13.346.0-beta.20250708124359
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 +1 -1
- package/src/foundry/client/canvas/groups/canvas-group-mixin.d.mts +1 -1
- package/src/foundry/client/canvas/rendering/shaders/weather/base-weather.d.mts +1 -1
- package/src/foundry/client/documents/active-effect.d.mts +14 -6
- package/src/foundry/client/documents/actor-delta.d.mts +13 -3
- package/src/foundry/client/documents/actor.d.mts +15 -5
- package/src/foundry/client/documents/adventure.d.mts +1 -1
- package/src/foundry/client/documents/ambient-light.d.mts +1 -1
- package/src/foundry/client/documents/ambient-sound.d.mts +1 -1
- package/src/foundry/client/documents/card.d.mts +14 -4
- package/src/foundry/client/documents/cards.d.mts +15 -5
- package/src/foundry/client/documents/chat-message.d.mts +14 -4
- package/src/foundry/client/documents/combat.d.mts +14 -4
- package/src/foundry/client/documents/combatant-group.d.mts +19 -10
- package/src/foundry/client/documents/combatant.d.mts +14 -4
- package/src/foundry/client/documents/drawing.d.mts +1 -1
- package/src/foundry/client/documents/fog-exploration.d.mts +1 -1
- package/src/foundry/client/documents/folder.d.mts +15 -5
- package/src/foundry/client/documents/item.d.mts +15 -5
- package/src/foundry/client/documents/journal-entry-category.d.mts +2 -2
- package/src/foundry/client/documents/journal-entry-page.d.mts +14 -7
- package/src/foundry/client/documents/journal-entry.d.mts +1 -1
- package/src/foundry/client/documents/macro.d.mts +14 -4
- package/src/foundry/client/documents/measured-template.d.mts +1 -1
- package/src/foundry/client/documents/note.d.mts +1 -1
- package/src/foundry/client/documents/playlist-sound.d.mts +1 -1
- package/src/foundry/client/documents/playlist.d.mts +1 -1
- package/src/foundry/client/documents/region-behavior.d.mts +16 -15
- package/src/foundry/client/documents/region.d.mts +1 -1
- package/src/foundry/client/documents/roll-table.d.mts +1 -1
- package/src/foundry/client/documents/scene.d.mts +1 -1
- package/src/foundry/client/documents/setting.d.mts +1 -1
- package/src/foundry/client/documents/table-result.d.mts +14 -5
- package/src/foundry/client/documents/tile.d.mts +1 -1
- package/src/foundry/client/documents/token.d.mts +1 -1
- package/src/foundry/client/documents/user.d.mts +1 -1
- package/src/foundry/client/documents/wall.d.mts +1 -1
- package/src/foundry/client/utils/helpers.d.mts +4 -9
- package/src/foundry/common/abstract/data.d.mts +1 -1
- package/src/foundry/common/abstract/document.d.mts +1 -9
- package/src/foundry/common/abstract/type-data.d.mts +1 -1
- package/src/utils/index.d.mts +2 -2
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.20250708124359",
|
5
5
|
"description": "TypeScript type definitions for Foundry VTT",
|
6
6
|
"type": "module",
|
7
7
|
"types": "./src/index.d.mts",
|
@@ -5,7 +5,7 @@ import type { CanvasLayer } from "#client/canvas/layers/_module.d.mts";
|
|
5
5
|
|
6
6
|
declare const DynamicClass: new <_Computed extends object>(...args: never) => _Computed;
|
7
7
|
|
8
|
-
// @ts-expect-error
|
8
|
+
// @ts-expect-error This is a workaround to allow for dynamic top level properties in a class.
|
9
9
|
declare class LayersClass<
|
10
10
|
Group extends CanvasGroupMixin.LayerGroup | NoLayerGroup,
|
11
11
|
Instance extends object = RemoveIndexSignatures<CanvasGroupMixin.LayersFor<Group>>,
|
@@ -11,7 +11,7 @@ interface InternalAbstractWeatherShader_Interface extends AbstractBaseShaderClas
|
|
11
11
|
|
12
12
|
declare const InternalAbstractWeatherShader_Const: InternalAbstractWeatherShader_Interface;
|
13
13
|
|
14
|
-
// @ts-expect-error
|
14
|
+
// @ts-expect-error This pattern inherently requires a ts-expect-error as the base class is dynamic.
|
15
15
|
class InternalAbstractWeatherShader<
|
16
16
|
DefaultUniforms extends AbstractBaseShader.Uniforms,
|
17
17
|
_ComputedUniforms extends object = RemoveIndexSignatures<DefaultUniforms>,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ConfiguredActiveEffect } from "fvtt-types/configuration";
|
2
2
|
import type {
|
3
3
|
AnyMutableObject,
|
4
|
+
Identity,
|
4
5
|
InexactPartial,
|
5
6
|
IntentionalPartial,
|
6
7
|
InterfaceToObject,
|
@@ -100,11 +101,18 @@ declare namespace ActiveEffect {
|
|
100
101
|
* builtin `ActiveEffect` class or a custom subclass if that is set up in
|
101
102
|
* {@link ConfiguredActiveEffect | `fvtt-types/configuration/ConfiguredActiveEffect`}.
|
102
103
|
*/
|
103
|
-
type OfType<Type extends SubType> =
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
105
|
+
|
106
|
+
/** @internal */
|
107
|
+
interface _OfType
|
108
|
+
extends Identity<{
|
109
|
+
[Type in SubType]: Type extends unknown
|
110
|
+
? ConfiguredActiveEffect<Type> extends { document: infer Document }
|
111
|
+
? Document
|
112
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
113
|
+
ActiveEffect<Type>
|
114
|
+
: never;
|
115
|
+
}> {}
|
108
116
|
|
109
117
|
/**
|
110
118
|
* `SystemOfType` returns the system property for a specific `ActiveEffect` subtype.
|
@@ -177,7 +185,7 @@ declare namespace ActiveEffect {
|
|
177
185
|
* An instance of `ActiveEffect` that comes from the database but failed validation meaning that
|
178
186
|
* its `system` and `_source` could theoretically be anything.
|
179
187
|
*/
|
180
|
-
|
188
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
181
189
|
|
182
190
|
/**
|
183
191
|
* An instance of `ActiveEffect` that comes from the database.
|
@@ -98,8 +98,18 @@ declare namespace ActorDelta {
|
|
98
98
|
* builtin `ActorDelta` class or a custom subclass if that is set up in
|
99
99
|
* {@link ConfiguredActorDelta | `fvtt-types/configuration/ConfiguredActorDelta`}.
|
100
100
|
*/
|
101
|
-
|
102
|
-
|
101
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
102
|
+
|
103
|
+
/** @internal */
|
104
|
+
interface _OfType
|
105
|
+
extends Identity<{
|
106
|
+
[Type in SubType]: Type extends unknown
|
107
|
+
? ConfiguredActorDelta<Type> extends { document: infer Document }
|
108
|
+
? Document
|
109
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
110
|
+
ActorDelta<Type>
|
111
|
+
: never;
|
112
|
+
}> {}
|
103
113
|
|
104
114
|
/**
|
105
115
|
* `SystemOfType` returns the system property for a specific `ActorDelta` subtype.
|
@@ -229,7 +239,7 @@ declare namespace ActorDelta {
|
|
229
239
|
* An instance of `ActorDelta` that comes from the database but failed validation meaning that
|
230
240
|
* its `system` and `_source` could theoretically be anything.
|
231
241
|
*/
|
232
|
-
|
242
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
233
243
|
|
234
244
|
/**
|
235
245
|
* An instance of `ActorDelta` that comes from the database.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AnyObject, InexactPartial, NullishProps, Merge } from "#utils";
|
1
|
+
import type { AnyObject, InexactPartial, NullishProps, Merge, Identity } from "#utils";
|
2
2
|
import type { documents } from "#client/client.d.mts";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type BaseActor from "#common/documents/actor.d.mts";
|
@@ -109,8 +109,18 @@ declare namespace Actor {
|
|
109
109
|
* builtin `Actor` class or a custom subclass if that is set up in
|
110
110
|
* {@link ConfiguredActor | `fvtt-types/configuration/ConfiguredActor`}.
|
111
111
|
*/
|
112
|
-
|
113
|
-
|
112
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
113
|
+
|
114
|
+
/** @internal */
|
115
|
+
interface _OfType
|
116
|
+
extends Identity<{
|
117
|
+
[Type in SubType]: Type extends unknown
|
118
|
+
? ConfiguredActor<Type> extends { document: infer Document }
|
119
|
+
? Document
|
120
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
121
|
+
Actor<Type>
|
122
|
+
: never;
|
123
|
+
}> {}
|
114
124
|
|
115
125
|
/**
|
116
126
|
* `SystemOfType` returns the system property for a specific `Actor` subtype.
|
@@ -238,7 +248,7 @@ declare namespace Actor {
|
|
238
248
|
* An instance of `Actor` that comes from the database but failed validation meaning that
|
239
249
|
* its `system` and `_source` could theoretically be anything.
|
240
250
|
*/
|
241
|
-
|
251
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
242
252
|
|
243
253
|
/**
|
244
254
|
* An instance of `Actor` that comes from the database.
|
@@ -303,7 +313,7 @@ declare namespace Actor {
|
|
303
313
|
|
304
314
|
/** An Actor subtype which configures the system data model applied */
|
305
315
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
306
|
-
type: fields.DocumentTypeField<typeof BaseActor, {}
|
316
|
+
type: fields.DocumentTypeField<typeof BaseActor, {}>;
|
307
317
|
|
308
318
|
/**
|
309
319
|
* An image file path which provides the artwork for this Actor
|
@@ -108,7 +108,7 @@ declare namespace Adventure {
|
|
108
108
|
* An instance of `Adventure` that comes from the database but failed validation meaning that
|
109
109
|
* its `system` and `_source` could theoretically be anything.
|
110
110
|
*/
|
111
|
-
|
111
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
112
112
|
|
113
113
|
/**
|
114
114
|
* An instance of `Adventure` that comes from the database.
|
@@ -108,7 +108,7 @@ declare namespace AmbientLightDocument {
|
|
108
108
|
* An instance of `AmbientLightDocument` that comes from the database but failed validation meaning that
|
109
109
|
* its `system` and `_source` could theoretically be anything.
|
110
110
|
*/
|
111
|
-
|
111
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
112
112
|
|
113
113
|
/**
|
114
114
|
* An instance of `AmbientLightDocument` that comes from the database.
|
@@ -108,7 +108,7 @@ declare namespace AmbientSoundDocument {
|
|
108
108
|
* An instance of `AmbientSoundDocument` that comes from the database but failed validation meaning that
|
109
109
|
* its `system` and `_source` could theoretically be anything.
|
110
110
|
*/
|
111
|
-
|
111
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
112
112
|
|
113
113
|
/**
|
114
114
|
* An instance of `AmbientSoundDocument` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredCard } from "fvtt-types/configuration";
|
2
|
-
import type { AnyObject, DeepPartial, InexactPartial, Merge } from "#utils";
|
2
|
+
import type { AnyObject, DeepPartial, Identity, InexactPartial, Merge } from "#utils";
|
3
3
|
import type { documents } from "#client/client.d.mts";
|
4
4
|
import type Document from "#common/abstract/document.d.mts";
|
5
5
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
@@ -99,8 +99,18 @@ declare namespace Card {
|
|
99
99
|
* builtin `Card` class or a custom subclass if that is set up in
|
100
100
|
* {@link ConfiguredCard | `fvtt-types/configuration/ConfiguredCard`}.
|
101
101
|
*/
|
102
|
-
|
103
|
-
|
102
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
103
|
+
|
104
|
+
/** @internal */
|
105
|
+
interface _OfType
|
106
|
+
extends Identity<{
|
107
|
+
[Type in SubType]: Type extends unknown
|
108
|
+
? ConfiguredCard<Type> extends { document: infer Document }
|
109
|
+
? Document
|
110
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
111
|
+
Card<Type>
|
112
|
+
: never;
|
113
|
+
}> {}
|
104
114
|
|
105
115
|
/**
|
106
116
|
* `SystemOfType` returns the system property for a specific `Card` subtype.
|
@@ -173,7 +183,7 @@ declare namespace Card {
|
|
173
183
|
* An instance of `Card` that comes from the database but failed validation meaning that
|
174
184
|
* its `system` and `_source` could theoretically be anything.
|
175
185
|
*/
|
176
|
-
|
186
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
177
187
|
|
178
188
|
/**
|
179
189
|
* An instance of `Card` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredCards } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge, NullishProps } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge, NullishProps } from "#utils";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
5
|
import type BaseCards from "#common/documents/cards.d.mts";
|
@@ -104,8 +104,18 @@ declare namespace Cards {
|
|
104
104
|
* builtin `Cards` class or a custom subclass if that is set up in
|
105
105
|
* {@link ConfiguredCards | `fvtt-types/configuration/ConfiguredCards`}.
|
106
106
|
*/
|
107
|
-
|
108
|
-
|
107
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
108
|
+
|
109
|
+
/** @internal */
|
110
|
+
interface _OfType
|
111
|
+
extends Identity<{
|
112
|
+
[Type in SubType]: Type extends unknown
|
113
|
+
? ConfiguredCards<Type> extends { document: infer Document }
|
114
|
+
? Document
|
115
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
116
|
+
Cards<Type>
|
117
|
+
: never;
|
118
|
+
}> {}
|
109
119
|
|
110
120
|
/**
|
111
121
|
* `SystemOfType` returns the system property for a specific `Cards` subtype.
|
@@ -233,7 +243,7 @@ declare namespace Cards {
|
|
233
243
|
* An instance of `Cards` that comes from the database but failed validation meaning that
|
234
244
|
* its `system` and `_source` could theoretically be anything.
|
235
245
|
*/
|
236
|
-
|
246
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
237
247
|
|
238
248
|
/**
|
239
249
|
* An instance of `Cards` that comes from the database.
|
@@ -301,7 +311,7 @@ declare namespace Cards {
|
|
301
311
|
* @defaultValue `BaseCards.TYPES[0]`
|
302
312
|
*/
|
303
313
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
304
|
-
type: fields.DocumentTypeField<typeof BaseCards, {}
|
314
|
+
type: fields.DocumentTypeField<typeof BaseCards, {}>;
|
305
315
|
|
306
316
|
/**
|
307
317
|
* A text description of this stack
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredChatMessage } from "fvtt-types/configuration";
|
2
|
-
import type { AnyObject, InexactPartial, InterfaceToObject, Merge, NullishProps } from "#utils";
|
2
|
+
import type { AnyObject, Identity, InexactPartial, InterfaceToObject, Merge, NullishProps } from "#utils";
|
3
3
|
import type { documents } from "#client/client.d.mts";
|
4
4
|
import type Document from "#common/abstract/document.d.mts";
|
5
5
|
import type { DataSchema, SchemaField } from "#common/data/fields.d.mts";
|
@@ -98,8 +98,18 @@ declare namespace ChatMessage {
|
|
98
98
|
* builtin `ChatMessage` class or a custom subclass if that is set up in
|
99
99
|
* {@link ConfiguredChatMessage | `fvtt-types/configuration/ConfiguredChatMessage`}.
|
100
100
|
*/
|
101
|
-
|
102
|
-
|
101
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
102
|
+
|
103
|
+
/** @internal */
|
104
|
+
interface _OfType
|
105
|
+
extends Identity<{
|
106
|
+
[Type in SubType]: Type extends unknown
|
107
|
+
? ConfiguredChatMessage<Type> extends { document: infer Document }
|
108
|
+
? Document
|
109
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
110
|
+
ChatMessage<Type>
|
111
|
+
: never;
|
112
|
+
}> {}
|
103
113
|
|
104
114
|
/**
|
105
115
|
* `SystemOfType` returns the system property for a specific `ChatMessage` subtype.
|
@@ -172,7 +182,7 @@ declare namespace ChatMessage {
|
|
172
182
|
* An instance of `ChatMessage` that comes from the database but failed validation meaning that
|
173
183
|
* its `system` and `_source` could theoretically be anything.
|
174
184
|
*/
|
175
|
-
|
185
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
176
186
|
|
177
187
|
/**
|
178
188
|
* An instance of `ChatMessage` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredCombat } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge, NullishProps } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge, NullishProps } from "#utils";
|
3
3
|
import type { documents } from "#client/client.d.mts";
|
4
4
|
import type Document from "#common/abstract/document.d.mts";
|
5
5
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
@@ -105,8 +105,18 @@ declare namespace Combat {
|
|
105
105
|
* builtin `Combat` class or a custom subclass if that is set up in
|
106
106
|
* {@link ConfiguredCombat | `fvtt-types/configuration/ConfiguredCombat`}.
|
107
107
|
*/
|
108
|
-
|
109
|
-
|
108
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
109
|
+
|
110
|
+
/** @internal */
|
111
|
+
interface _OfType
|
112
|
+
extends Identity<{
|
113
|
+
[Type in SubType]: Type extends unknown
|
114
|
+
? ConfiguredCombat<Type> extends { document: infer Document }
|
115
|
+
? Document
|
116
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
117
|
+
Combat<Type>
|
118
|
+
: never;
|
119
|
+
}> {}
|
110
120
|
|
111
121
|
/**
|
112
122
|
* `SystemOfType` returns the system property for a specific `Combat` subtype.
|
@@ -240,7 +250,7 @@ declare namespace Combat {
|
|
240
250
|
* An instance of `Combat` that comes from the database but failed validation meaning that
|
241
251
|
* its `system` and `_source` could theoretically be anything.
|
242
252
|
*/
|
243
|
-
|
253
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
244
254
|
|
245
255
|
/**
|
246
256
|
* An instance of `Combat` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredCombatantGroup } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge } from "#utils";
|
3
3
|
import type Document from "#common/abstract/document.mjs";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
5
|
import type BaseCombatantGroup from "#common/documents/combatant-group.d.mts";
|
@@ -81,11 +81,18 @@ declare namespace CombatantGroup {
|
|
81
81
|
* builtin `CombatantGroup` class or a custom subclass if that is set up in
|
82
82
|
* {@link ConfiguredCombatantGroup | `fvtt-types/configuration/ConfiguredCombatantGroup`}.
|
83
83
|
*/
|
84
|
-
type OfType<Type extends SubType> =
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
85
|
+
|
86
|
+
/** @internal */
|
87
|
+
interface _OfType
|
88
|
+
extends Identity<{
|
89
|
+
[Type in SubType]: Type extends unknown
|
90
|
+
? ConfiguredCombatantGroup<Type> extends { document: infer Document }
|
91
|
+
? Document
|
92
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
93
|
+
CombatantGroup<Type>
|
94
|
+
: never;
|
95
|
+
}> {}
|
89
96
|
|
90
97
|
/**
|
91
98
|
* `SystemOfType` returns the system property for a specific `CombatantGroup` subtype.
|
@@ -158,14 +165,16 @@ declare namespace CombatantGroup {
|
|
158
165
|
* An instance of `CombatantGroup` that comes from the database but failed validation meaning that
|
159
166
|
* its `system` and `_source` could theoretically be anything.
|
160
167
|
*/
|
161
|
-
|
162
|
-
|
168
|
+
type Invalid<SubType extends CombatantGroup.SubType = CombatantGroup.SubType> = Document.Internal.Invalid<
|
169
|
+
OfType<SubType>
|
170
|
+
>;
|
163
171
|
|
164
172
|
/**
|
165
173
|
* An instance of `CombatantGroup` that comes from the database.
|
166
174
|
*/
|
167
|
-
|
168
|
-
|
175
|
+
type Stored<SubType extends CombatantGroup.SubType = CombatantGroup.SubType> = Document.Internal.Stored<
|
176
|
+
OfType<SubType>
|
177
|
+
>;
|
169
178
|
|
170
179
|
/**
|
171
180
|
* The data put in {@link CombatantGroup._source | `CombatantGroup#_source`}. This data is what was
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredCombatant } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge, RequiredProps } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge, RequiredProps } from "#utils";
|
3
3
|
import type { documents } from "#client/client.d.mts";
|
4
4
|
import type Document from "#common/abstract/document.d.mts";
|
5
5
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
@@ -99,8 +99,18 @@ declare namespace Combatant {
|
|
99
99
|
* builtin `Combatant` class or a custom subclass if that is set up in
|
100
100
|
* {@link ConfiguredCombatant | `fvtt-types/configuration/ConfiguredCombatant`}.
|
101
101
|
*/
|
102
|
-
|
103
|
-
|
102
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
103
|
+
|
104
|
+
/** @internal */
|
105
|
+
interface _OfType
|
106
|
+
extends Identity<{
|
107
|
+
[Type in SubType]: Type extends unknown
|
108
|
+
? ConfiguredCombatant<Type> extends { document: infer Document }
|
109
|
+
? Document
|
110
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
111
|
+
Combatant<Type>
|
112
|
+
: never;
|
113
|
+
}> {}
|
104
114
|
|
105
115
|
/**
|
106
116
|
* `SystemOfType` returns the system property for a specific `Combatant` subtype.
|
@@ -173,7 +183,7 @@ declare namespace Combatant {
|
|
173
183
|
* An instance of `Combatant` that comes from the database but failed validation meaning that
|
174
184
|
* its `system` and `_source` could theoretically be anything.
|
175
185
|
*/
|
176
|
-
|
186
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
177
187
|
|
178
188
|
/**
|
179
189
|
* An instance of `Combatant` that comes from the database.
|
@@ -119,7 +119,7 @@ declare namespace DrawingDocument {
|
|
119
119
|
* An instance of `DrawingDocument` that comes from the database but failed validation meaning that
|
120
120
|
* its `system` and `_source` could theoretically be anything.
|
121
121
|
*/
|
122
|
-
|
122
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
123
123
|
|
124
124
|
/**
|
125
125
|
* An instance of `DrawingDocument` that comes from the database.
|
@@ -120,7 +120,7 @@ declare namespace FogExploration {
|
|
120
120
|
* An instance of `FogExploration` that comes from the database but failed validation meaning that
|
121
121
|
* its `system` and `_source` could theoretically be anything.
|
122
122
|
*/
|
123
|
-
|
123
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
124
124
|
|
125
125
|
/**
|
126
126
|
* An instance of `FogExploration` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredFolder } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, IntentionalPartial, Merge, NullishProps } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, IntentionalPartial, Merge, NullishProps } from "#utils";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
5
|
import type BaseFolder from "#common/documents/folder.d.mts";
|
@@ -91,8 +91,18 @@ declare namespace Folder {
|
|
91
91
|
* Note that `Folder` does not have a `system` property and therefore there is no way for a user
|
92
92
|
* to configure custom subtypes. See {@linkcode Folder.SubType} for more information.
|
93
93
|
*/
|
94
|
-
|
95
|
-
|
94
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
95
|
+
|
96
|
+
/** @internal */
|
97
|
+
interface _OfType
|
98
|
+
extends Identity<{
|
99
|
+
[Type in SubType]: Type extends unknown
|
100
|
+
? ConfiguredFolder<Type> extends { document: infer Document }
|
101
|
+
? Document
|
102
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
103
|
+
Folder<Type>
|
104
|
+
: never;
|
105
|
+
}> {}
|
96
106
|
|
97
107
|
/**
|
98
108
|
* A document's parent is something that can contain it.
|
@@ -150,7 +160,7 @@ declare namespace Folder {
|
|
150
160
|
* An instance of `Folder` that comes from the database but failed validation meaning that
|
151
161
|
* its `system` and `_source` could theoretically be anything.
|
152
162
|
*/
|
153
|
-
|
163
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
154
164
|
|
155
165
|
/**
|
156
166
|
* An instance of `Folder` that comes from the database.
|
@@ -215,7 +225,7 @@ declare namespace Folder {
|
|
215
225
|
|
216
226
|
/** The document type which this Folder contains, from {@linkcode CONST.FOLDER_DOCUMENT_TYPES} */
|
217
227
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
218
|
-
type: fields.DocumentTypeField<typeof BaseFolder, {}
|
228
|
+
type: fields.DocumentTypeField<typeof BaseFolder, {}>;
|
219
229
|
|
220
230
|
/**
|
221
231
|
* An HTML description of the contents of this folder
|
@@ -2,7 +2,7 @@ import type { ConfiguredItem } from "fvtt-types/configuration";
|
|
2
2
|
import type { documents } from "#client/client.d.mts";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
|
-
import type { AnyObject, InexactPartial, Merge } from "#utils";
|
5
|
+
import type { AnyObject, Identity, InexactPartial, Merge } from "#utils";
|
6
6
|
import type BaseItem from "#common/documents/item.mjs";
|
7
7
|
|
8
8
|
import fields = foundry.data.fields;
|
@@ -106,8 +106,18 @@ declare namespace Item {
|
|
106
106
|
* builtin `Item` class or a custom subclass if that is set up in
|
107
107
|
* {@link ConfiguredItem | `fvtt-types/configuration/ConfiguredItem`}.
|
108
108
|
*/
|
109
|
-
|
110
|
-
|
109
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
110
|
+
|
111
|
+
/** @internal */
|
112
|
+
interface _OfType
|
113
|
+
extends Identity<{
|
114
|
+
[Type in SubType]: Type extends unknown
|
115
|
+
? ConfiguredItem<Type> extends { document: infer Document }
|
116
|
+
? Document
|
117
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
118
|
+
Item<Type>
|
119
|
+
: never;
|
120
|
+
}> {}
|
111
121
|
|
112
122
|
/**
|
113
123
|
* `SystemOfType` returns the system property for a specific `Item` subtype.
|
@@ -235,7 +245,7 @@ declare namespace Item {
|
|
235
245
|
* An instance of `Item` that comes from the database but failed validation meaning that
|
236
246
|
* its `system` and `_source` could theoretically be anything.
|
237
247
|
*/
|
238
|
-
|
248
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
239
249
|
|
240
250
|
/**
|
241
251
|
* An instance of `Item` that comes from the database.
|
@@ -300,7 +310,7 @@ declare namespace Item {
|
|
300
310
|
|
301
311
|
/** An Item subtype which configures the system data model applied */
|
302
312
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
303
|
-
type: fields.DocumentTypeField<typeof documents.BaseItem, {}
|
313
|
+
type: fields.DocumentTypeField<typeof documents.BaseItem, {}>;
|
304
314
|
|
305
315
|
/**
|
306
316
|
* An image file path which provides the artwork for this Item
|
@@ -102,12 +102,12 @@ declare namespace JournalEntryCategory {
|
|
102
102
|
* An instance of `JournalEntryCategory` that comes from the database but failed validation meaning that
|
103
103
|
* its `system` and `_source` could theoretically be anything.
|
104
104
|
*/
|
105
|
-
|
105
|
+
type Invalid = Document.Internal.Invalid<JournalEntryCategory.Implementation>;
|
106
106
|
|
107
107
|
/**
|
108
108
|
* An instance of `JournalEntryCategory` that comes from the database.
|
109
109
|
*/
|
110
|
-
|
110
|
+
type Stored = Document.Internal.Stored<JournalEntryCategory.Implementation>;
|
111
111
|
|
112
112
|
/**
|
113
113
|
* The data put in {@link JournalEntryCategory._source | `JournalEntryCategory#_source`}. This data is what was
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredJournalEntryPage } from "fvtt-types/configuration";
|
2
|
-
import type { AnyObject, InexactPartial, Merge, NullishProps } from "#utils";
|
2
|
+
import type { AnyObject, Identity, InexactPartial, Merge, NullishProps } from "#utils";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
5
|
import type BaseJournalEntryPage from "#common/documents/journal-entry-page.d.mts";
|
@@ -98,11 +98,18 @@ declare namespace JournalEntryPage {
|
|
98
98
|
* {@link ConfiguredJournalEntryPage | `fvtt-types/configuration/ConfiguredJournalEntryPage`}.
|
99
99
|
* up.
|
100
100
|
*/
|
101
|
-
type OfType<Type extends SubType> =
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
102
|
+
|
103
|
+
/** @internal */
|
104
|
+
interface _OfType
|
105
|
+
extends Identity<{
|
106
|
+
[Type in SubType]: Type extends unknown
|
107
|
+
? ConfiguredJournalEntryPage<Type> extends { document: infer Document }
|
108
|
+
? Document
|
109
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
110
|
+
JournalEntryPage<Type>
|
111
|
+
: never;
|
112
|
+
}> {}
|
106
113
|
|
107
114
|
/**
|
108
115
|
* `SystemOfType` returns the system property for a specific `JournalEntryPage` subtype.
|
@@ -175,7 +182,7 @@ declare namespace JournalEntryPage {
|
|
175
182
|
* An instance of `JournalEntryPage` that comes from the database but failed validation meaning that
|
176
183
|
* its `system` and `_source` could theoretically be anything.
|
177
184
|
*/
|
178
|
-
|
185
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
179
186
|
|
180
187
|
/**
|
181
188
|
* An instance of `JournalEntryPage` that comes from the database.
|
@@ -185,7 +185,7 @@ declare namespace JournalEntry {
|
|
185
185
|
* An instance of `JournalEntry` that comes from the database but failed validation meaning that
|
186
186
|
* its `system` and `_source` could theoretically be anything.
|
187
187
|
*/
|
188
|
-
|
188
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
189
189
|
|
190
190
|
/**
|
191
191
|
* An instance of `JournalEntry` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredMacro } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge, NullishProps } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge, NullishProps } from "#utils";
|
3
3
|
import type { documents } from "#client/client.d.mts";
|
4
4
|
import type Document from "#common/abstract/document.d.mts";
|
5
5
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
@@ -101,8 +101,18 @@ declare namespace Macro {
|
|
101
101
|
* Note that `Macro` does not have a `system` property and therefore there is no way for a user
|
102
102
|
* to configure custom subtypes. See {@linkcode Macro.SubType} for more information.
|
103
103
|
*/
|
104
|
-
|
105
|
-
|
104
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
105
|
+
|
106
|
+
/** @internal */
|
107
|
+
interface _OfType
|
108
|
+
extends Identity<{
|
109
|
+
[Type in SubType]: Type extends unknown
|
110
|
+
? ConfiguredMacro<Type> extends { document: infer Document }
|
111
|
+
? Document
|
112
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
113
|
+
Macro<Type>
|
114
|
+
: never;
|
115
|
+
}> {}
|
106
116
|
|
107
117
|
/**
|
108
118
|
* A document's parent is something that can contain it.
|
@@ -160,7 +170,7 @@ declare namespace Macro {
|
|
160
170
|
* An instance of `Macro` that comes from the database but failed validation meaning that
|
161
171
|
* its `system` and `_source` could theoretically be anything.
|
162
172
|
*/
|
163
|
-
|
173
|
+
type Invalid = Document.Internal.Invalid<OfType<SubType>>;
|
164
174
|
|
165
175
|
/**
|
166
176
|
* An instance of `Macro` that comes from the database.
|
@@ -118,7 +118,7 @@ declare namespace MeasuredTemplateDocument {
|
|
118
118
|
* An instance of `MeasuredTemplateDocument` that comes from the database but failed validation meaning that
|
119
119
|
* its `system` and `_source` could theoretically be anything.
|
120
120
|
*/
|
121
|
-
|
121
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
122
122
|
|
123
123
|
/**
|
124
124
|
* An instance of `MeasuredTemplateDocument` that comes from the database.
|
@@ -118,7 +118,7 @@ declare namespace NoteDocument {
|
|
118
118
|
* An instance of `NoteDocument` that comes from the database but failed validation meaning that
|
119
119
|
* its `system` and `_source` could theoretically be anything.
|
120
120
|
*/
|
121
|
-
|
121
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
122
122
|
|
123
123
|
/**
|
124
124
|
* An instance of `NoteDocument` that comes from the database.
|
@@ -120,7 +120,7 @@ declare namespace PlaylistSound {
|
|
120
120
|
* An instance of `PlaylistSound` that comes from the database but failed validation meaning that
|
121
121
|
* its `system` and `_source` could theoretically be anything.
|
122
122
|
*/
|
123
|
-
|
123
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
124
124
|
|
125
125
|
/**
|
126
126
|
* An instance of `PlaylistSound` that comes from the database.
|
@@ -179,7 +179,7 @@ declare namespace Playlist {
|
|
179
179
|
* An instance of `Playlist` that comes from the database but failed validation meaning that
|
180
180
|
* its `system` and `_source` could theoretically be anything.
|
181
181
|
*/
|
182
|
-
|
182
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
183
183
|
|
184
184
|
/**
|
185
185
|
* An instance of `Playlist` that comes from the database.
|
@@ -2,7 +2,7 @@ import type { ConfiguredRegionBehavior } from "fvtt-types/configuration";
|
|
2
2
|
import type Document from "#common/abstract/document.d.mts";
|
3
3
|
import type BaseRegionBehavior from "#common/documents/region-behavior.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
|
-
import type { InexactPartial, Merge } from "#utils";
|
5
|
+
import type { Identity, InexactPartial, Merge } from "#utils";
|
6
6
|
|
7
7
|
import fields = foundry.data.fields;
|
8
8
|
|
@@ -107,11 +107,18 @@ declare namespace RegionBehavior {
|
|
107
107
|
* builtin `RegionBehavior` class or a custom subclass if that is set up in
|
108
108
|
* {@link ConfiguredRegionBehavior | `fvtt-types/configuration/ConfiguredRegionBehavior`}.
|
109
109
|
*/
|
110
|
-
type OfType<Type extends SubType> =
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
111
|
+
|
112
|
+
/** @internal */
|
113
|
+
interface _OfType
|
114
|
+
extends Identity<{
|
115
|
+
[Type in SubType]: Type extends unknown
|
116
|
+
? ConfiguredRegionBehavior<Type> extends { document: infer Document }
|
117
|
+
? Document
|
118
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
119
|
+
RegionBehavior<Type>
|
120
|
+
: never;
|
121
|
+
}> {}
|
115
122
|
|
116
123
|
/**
|
117
124
|
* `SystemOfType` returns the system property for a specific `RegionBehavior` subtype.
|
@@ -184,7 +191,7 @@ declare namespace RegionBehavior {
|
|
184
191
|
* An instance of `RegionBehavior` that comes from the database but failed validation meaning that
|
185
192
|
* its `system` and `_source` could theoretically be anything.
|
186
193
|
*/
|
187
|
-
|
194
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
188
195
|
|
189
196
|
/**
|
190
197
|
* An instance of `RegionBehavior` that comes from the database.
|
@@ -255,14 +262,8 @@ declare namespace RegionBehavior {
|
|
255
262
|
/**
|
256
263
|
* An RegionBehavior subtype which configures the system data model applied
|
257
264
|
*/
|
258
|
-
type
|
259
|
-
|
260
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
261
|
-
{},
|
262
|
-
RegionBehavior.SubType,
|
263
|
-
RegionBehavior.SubType,
|
264
|
-
RegionBehavior.SubType
|
265
|
-
>;
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
266
|
+
type: fields.DocumentTypeField<typeof BaseRegionBehavior, {}>;
|
266
267
|
|
267
268
|
/**
|
268
269
|
* Data for a RegionBehavior subtype, defined by a System or Module
|
@@ -454,7 +454,7 @@ declare namespace RegionDocument {
|
|
454
454
|
* An instance of `Region` that comes from the database but failed validation meaning that
|
455
455
|
* its `system` and `_source` could theoretically be anything.
|
456
456
|
*/
|
457
|
-
|
457
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
458
458
|
|
459
459
|
/**
|
460
460
|
* An instance of `Region` that comes from the database.
|
@@ -174,7 +174,7 @@ declare namespace RollTable {
|
|
174
174
|
* An instance of `RollTable` that comes from the database but failed validation meaning that
|
175
175
|
* its `system` and `_source` could theoretically be anything.
|
176
176
|
*/
|
177
|
-
|
177
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
178
178
|
|
179
179
|
/**
|
180
180
|
* An instance of `RollTable` that comes from the database.
|
@@ -199,7 +199,7 @@ declare namespace Scene {
|
|
199
199
|
* An instance of `Scene` that comes from the database but failed validation meaning that
|
200
200
|
* its `system` and `_source` could theoretically be anything.
|
201
201
|
*/
|
202
|
-
|
202
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
203
203
|
|
204
204
|
/**
|
205
205
|
* An instance of `Scene` that comes from the database.
|
@@ -117,7 +117,7 @@ declare namespace Setting {
|
|
117
117
|
* An instance of `Setting` that comes from the database but failed validation meaning that
|
118
118
|
* its `system` and `_source` could theoretically be anything.
|
119
119
|
*/
|
120
|
-
|
120
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
121
121
|
|
122
122
|
/**
|
123
123
|
* An instance of `Setting` that comes from the database.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ConfiguredTableResult } from "fvtt-types/configuration";
|
2
|
-
import type { InexactPartial, Merge } from "#utils";
|
2
|
+
import type { Identity, InexactPartial, Merge } from "#utils";
|
3
3
|
import type Document from "#common/abstract/document.d.mts";
|
4
4
|
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
5
|
import type BaseTableResult from "#common/documents/table-result.d.mts";
|
@@ -95,8 +95,18 @@ declare namespace TableResult {
|
|
95
95
|
* Note that `TableResult` does not have a `system` property and therefore there is no way for a user
|
96
96
|
* to configure custom subtypes. See {@linkcode TableResult.SubType} for more information.
|
97
97
|
*/
|
98
|
-
|
99
|
-
|
98
|
+
type OfType<Type extends SubType> = _OfType[Type];
|
99
|
+
|
100
|
+
/** @internal */
|
101
|
+
interface _OfType
|
102
|
+
extends Identity<{
|
103
|
+
[Type in SubType]: Type extends unknown
|
104
|
+
? ConfiguredTableResult<Type> extends { document: infer Document }
|
105
|
+
? Document
|
106
|
+
: // eslint-disable-next-line @typescript-eslint/no-restricted-types
|
107
|
+
TableResult<Type>
|
108
|
+
: never;
|
109
|
+
}> {}
|
100
110
|
|
101
111
|
/**
|
102
112
|
* A document's parent is something that can contain it.
|
@@ -153,8 +163,7 @@ declare namespace TableResult {
|
|
153
163
|
* An instance of `TableResult` that comes from the database but failed validation meaning that
|
154
164
|
* its `system` and `_source` could theoretically be anything.
|
155
165
|
*/
|
156
|
-
|
157
|
-
extends Document.Internal.Invalid<OfType<SubType>> {}
|
166
|
+
type Invalid<SubType extends TableResult.SubType = TableResult.SubType> = Document.Internal.Invalid<OfType<SubType>>;
|
158
167
|
|
159
168
|
/**
|
160
169
|
* An instance of `TableResult` that comes from the database.
|
@@ -107,7 +107,7 @@ declare namespace TileDocument {
|
|
107
107
|
* An instance of `TileDocument` that comes from the database but failed validation meaning that
|
108
108
|
* its `system` and `_source` could theoretically be anything.
|
109
109
|
*/
|
110
|
-
|
110
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
111
111
|
|
112
112
|
/**
|
113
113
|
* An instance of `TileDocument` that comes from the database.
|
@@ -191,7 +191,7 @@ declare namespace TokenDocument {
|
|
191
191
|
* An instance of `TokenDocument` that comes from the database but failed validation meaning that
|
192
192
|
* its `system` and `_source` could theoretically be anything.
|
193
193
|
*/
|
194
|
-
|
194
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
195
195
|
|
196
196
|
/**
|
197
197
|
* An instance of `TokenDocument` that comes from the database.
|
@@ -121,7 +121,7 @@ declare namespace User {
|
|
121
121
|
* An instance of `User` that comes from the database but failed validation meaning that
|
122
122
|
* its `system` and `_source` could theoretically be anything.
|
123
123
|
*/
|
124
|
-
|
124
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
125
125
|
|
126
126
|
/**
|
127
127
|
* An instance of `User` that comes from the database.
|
@@ -115,7 +115,7 @@ declare namespace WallDocument {
|
|
115
115
|
* An instance of `WallDocument` that comes from the database but failed validation meaning that
|
116
116
|
* its `system` and `_source` could theoretically be anything.
|
117
117
|
*/
|
118
|
-
|
118
|
+
type Invalid = Document.Internal.Invalid<Implementation>;
|
119
119
|
|
120
120
|
/**
|
121
121
|
* An instance of `WallDocument` that comes from the database.
|
@@ -72,6 +72,7 @@ export function fromUuidSync<
|
|
72
72
|
>(
|
73
73
|
uuid: FromUuidValidate<ConcreteDocument, Uuid> | null | undefined,
|
74
74
|
options?: FromUuidSyncOptions,
|
75
|
+
// TODO(LukeAbby): `AnyObject` is actually a stand in for a compendium index entry which should be typed.
|
75
76
|
): (__UnsetDocument extends ConcreteDocument ? FromUuid<Uuid> : ConcreteDocument) | AnyObject | null;
|
76
77
|
|
77
78
|
declare const __Unset: unique symbol;
|
@@ -88,15 +89,9 @@ type FromUuid<Uuid extends string> = Uuid extends `${string}.${string}.${infer R
|
|
88
89
|
? Document.ImplementationFor<DocumentType>
|
89
90
|
: InvalidUuid;
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
Uuid extends string,
|
95
|
-
> = __UnsetDocument extends ConcreteDocument
|
96
|
-
? MustBeValidUuid<Uuid, Document.Type>
|
97
|
-
: string extends Uuid
|
98
|
-
? string
|
99
|
-
: MustBeValidUuid<Uuid, ConcreteDocument["documentName"]>;
|
92
|
+
type FromUuidValidate<ConcreteDocument extends Document.Any, Uuid extends string> = string extends Uuid
|
93
|
+
? string
|
94
|
+
: MustBeValidUuid<Uuid, ConcreteDocument["documentName"]>;
|
100
95
|
|
101
96
|
/**
|
102
97
|
* Return a reference to the Document class implementation which is configured for use.
|
@@ -7,7 +7,7 @@ type DataSchema = fields.DataSchema;
|
|
7
7
|
|
8
8
|
declare const DynamicClass: new <_Computed extends object>(...args: never) => _Computed;
|
9
9
|
|
10
|
-
// @ts-expect-error
|
10
|
+
// @ts-expect-error This is a workaround to allow for dynamic top level properties in a class.
|
11
11
|
declare class _InternalDataModel<
|
12
12
|
out Schema extends DataSchema,
|
13
13
|
// Do not inline. Being a type parameter is an important part of the circumvention of TypeScript's detection of dynamic classes.
|
@@ -1126,14 +1126,6 @@ declare namespace Document {
|
|
1126
1126
|
type Complete<T extends Any> = T extends Document.Any ? T : never;
|
1127
1127
|
}
|
1128
1128
|
|
1129
|
-
// Note(LukeAbby): `Configured` is not checked for validity. This means that it's easy to
|
1130
|
-
// accidently misconfigure without warning. However it helps stymy some circularities this way.
|
1131
|
-
// This is also why `LazyDocument` takes a callback.
|
1132
|
-
// See: https://gist.github.com/LukeAbby/a7892327633587ba89e760b599572322
|
1133
|
-
type OfType<Configured, LazyDocument extends () => unknown> = "document" extends keyof Configured
|
1134
|
-
? Configured["document"]
|
1135
|
-
: ReturnType<LazyDocument>;
|
1136
|
-
|
1137
1129
|
type ModelMap<Name extends Document.WithSubTypes> = _ModelMap<
|
1138
1130
|
Name,
|
1139
1131
|
// `{}` is used to avoid `keyof never` issues.
|
@@ -1206,7 +1198,7 @@ declare namespace Document {
|
|
1206
1198
|
}
|
1207
1199
|
>;
|
1208
1200
|
|
1209
|
-
// @ts-expect-error
|
1201
|
+
// @ts-expect-error This pattern is inherently an error.
|
1210
1202
|
interface Invalid<D extends Document.Any> extends _Invalid, D {}
|
1211
1203
|
|
1212
1204
|
/** @internal */
|
@@ -31,7 +31,7 @@ interface _InternalTypeDataModelInterface extends DataModel.AnyConstructor {
|
|
31
31
|
// is used instead. it doesn't work.
|
32
32
|
//
|
33
33
|
// See: https://gist.github.com/LukeAbby/b9fd57eeba778a25297721e88b3e6bdd
|
34
|
-
// @ts-expect-error
|
34
|
+
// @ts-expect-error This pattern is inherently an error.
|
35
35
|
interface DataModelOverride<Schema extends DataSchema, Parent extends Document.Any, _ComputedInstance extends object>
|
36
36
|
extends _ComputedInstance,
|
37
37
|
DataModel<Schema, Parent> {}
|
package/src/utils/index.d.mts
CHANGED
@@ -682,7 +682,7 @@ interface _MergeComplexObject<T extends object, U extends object> extends _Overr
|
|
682
682
|
*/
|
683
683
|
export type Override<T extends object, U extends object> = T extends unknown ? _Override<T, U> : never;
|
684
684
|
|
685
|
-
// @ts-expect-error
|
685
|
+
// @ts-expect-error This pattern is inherently an error.
|
686
686
|
interface _Override<T extends object, U extends object> extends U, T {}
|
687
687
|
|
688
688
|
/**
|
@@ -1317,7 +1317,7 @@ type _DeepReadonly<T> = T extends object ? DeepReadonly<T> : T;
|
|
1317
1317
|
|
1318
1318
|
interface DeepReadonlyComplex<T extends object> extends _DeepReadonlyComplex<T> {}
|
1319
1319
|
|
1320
|
-
// @ts-expect-error
|
1320
|
+
// @ts-expect-error This pattern is intrinsically an error.
|
1321
1321
|
// Note(LukeAbby): The two levels here, `DeepReadonlyComplex` and `_DeepReadonlyComplex`, could just be one.
|
1322
1322
|
// However it gives a better type display as two levels.
|
1323
1323
|
interface _DeepReadonlyComplex<T extends object, R extends object = { readonly [K in keyof T]: _DeepReadonly<T[K]> }>
|