Class InspectableArray

The InspectableArray class provides reflection for a TypeScript array. The primary use-case for this class is type reflection within the Inspector APIs.

Constructors

  • Constructor for use by the runtime only.

    Parameters

    • elementType: Type

      TypeScript type of the elements in the array.

    • parentProperty: InspectableProperty

      Property used for retrieving this entry.

    Returns InspectableArray

Properties

parentProperty: InspectableProperty

The parent property that owns the array.

Accessors

  • get elementType(): Type
  • Type used for the elements stored in the array.

    Returns Type

  • get elementTypeArguments(): Type[]
  • Type arguments used for the elements stored in the array.

    Returns Type[]

Methods

  • Adds a new element to the end of the array.

    Parameters

    • value: any

      The value to be added at the end of the array.

    Returns void

  • Returns a serializable property for a specific array element.

    Parameters

    • elementIndex: number

      Index of the element in the array.

    Returns InspectableProperty

    Serializable property that allows you to manipulate contents of the array entry.

  • Uses the provided path elements to find an array element at the specified index, and returns a property to the element, or to a child property of that element.

    Parameters

    • pathElements: PropertyPathElement[]

      Path elements representing field names and keys to look for.

    • elementIndex: number

      Index in the pathElements array to start the search at.

    Returns InspectableProperty

    Property representing the final path element, or null if not found (array index is out of range, or property with that path doesn't exist).

  • Gets the value from the array at the specified index.

    Parameters

    • index: number

    Returns any

  • Returns number of elements in the array.

    Returns number

    Number of elements in the array.

  • Removes the item at the given index.

    Parameters

    • index: number

      The index to remove the item at.

    Returns void

  • Resizes the array to the given newSize.

    Parameters

    • newSize: number

      The new size of the array. New items will be null and extra items will be discarded.

    Returns void

  • Assigns the value to the array at the specified index.

    Parameters

    • index: number
    • value: any

    Returns void

  • Swaps the items at index1 and index2.

    Parameters

    • index1: number
    • index2: number

    Returns void

  • Gets the value from the array at the specified index.

    Type Parameters

    • T = any

    Parameters

    • array: T[]
    • index: number

    Returns T

  • Assigns the value to the array at the specified index.

    Type Parameters

    • T = any

    Parameters

    • array: T[]
    • index: number
    • value: T

    Returns void