• Public
  • Public/Protected
  • All

Module Value


  • A mixin[1] that allows each DOM class to effectively extend two different parent classes:

    1. The corresponding native JS data type (dom.String extends String, dom.Integer extends Number, etc.)
    2. A new class constructed by the DomValue method which provides functionality common to all DOM elements. This includes storing/accessing an Ion data type and annotations, as well as convenience methods for converting from Ion data types to JS data types.

    [1] https://www.typescriptlang.org/docs/handbook/mixins.html

    Type parameters


    • BaseClass: Clazz

      A parent type for the newly constructed class to extend.

    • ionType: IonType

      The Ion data type that will be associated with new instances of the constructed class.

    • fromJsConstructor: FromJsConstructor

      Calls the class's primary constructor with a Javascript value after performing configured validation and adaptation logic.

    Returns newClass & Clazz





  • from(value: any, annotations?: string[]): Value
  • Constructs a dom.Value from the provided Javascript value using the following type mappings:

    JS Type | dom.Value subclass

    null | dom.Null boolean | dom.Boolean number | dom.Integer or dom.Float BigInt | dom.Integer string | dom.String Decimal | dom.Decimal Date | dom.Timestamp Timestamp | dom.Timestamp Uint8Array | dom.Blob Array | dom.List Object | dom.Struct

    Other input types (including 'undefined') are not supported and will throw an Error.

    If the input type is an Array or Object, this method will also convert each nested javascript values into a dom.Value.


    • value: any

      A javascript value to convert into an Ion dom.Value.

    • Optional annotations: string[]

      An optional array of strings to associate with the newly created dom.Value. These annotations will NOT be associated with any nested dom.Values.

    Returns Value