@salesforce/ts-types
    Preparing search index...

    Function asInstance

    • Narrows an unknown value to an instance of constructor type T if it is type-compatible, or returns undefined otherwise.

      Type Parameters

      Parameters

      • value: unknown

        The value to test.

      • ctor: C

      Returns Optional<InstanceType<C>>

    • Narrows an unknown value to an object if it is type-compatible, or returns the provided default otherwise.

      Type Parameters

      Parameters

      • value: unknown

        The value to test.

      • ctor: C
      • defaultValue: InstanceType<C>

        The default to return if value was undefined or of the incorrect type.

      Returns InstanceType<C>