Options
All
  • Public
  • Public/Protected
  • All
Menu

Project ldtk

Index

Type aliases

Field

Represents a pre-parsed Entity field

Examples:

Array<MyEnum.A> will result in:

{ type: "Enum", value: "A", ref: MyEnum }

Where MyEnum is not an identifier, but a reference to the Enum:

const entity = layer.entities[0];
entity.fields["enum_field"].ref.uid // you can access the enum properties

Having all the field interfaces in a union allows narrowing a generic field type down to a specific field type:

const field: Field = // ...
if (field.type === FieldType.Int) {
    // value has type `number | null`
    const value = field.value;
}

Generated using TypeDoc