Skip to content

@vttforge/types / TypeDataModelMembers

Interface: TypeDataModelMembers<Parent>

What a TypeDataModel instance carries beyond its own schema fields.

parent is the one that matters: inside prepareDerivedData() it is the Actor or Item this data belongs to, and reaching it was a cast until now.

Type Parameters

Parent

Parent = DocumentMembers

Properties

parent

readonly parent: Parent

The document this data belongs to: the Actor or Item whose system this is. Inside prepareDerivedData() this is how you read the rest of the document, this.parent.name or this.parent.items.

Foundry types it nullable because a DataModel can stand on its own. A type data model cannot: Foundry builds it with the document as parent.

Methods

toObject()

toObject(source?): Record<string, unknown>

A plain-object copy of the data.

Parameters

source?

boolean

Returns

Record<string, unknown>


updateSource()

updateSource(changes?, options?): Record<string, unknown>

Change the source data in memory, without a database write.

Parameters

changes?

Record<string, unknown>

options?

Record<string, unknown>

Returns

Record<string, unknown>

MIT licensed.