schema-components - v3.7.0
    Preparing search index...

    Function resolveDiscriminatedActive

    • Derive labels, active index, and active option for a discriminated union.

      For each option, the label is the discriminator property's const value (when the option is an object with a literal discriminator) or, failing that, the option's meta.title or its type. The active index is chosen from the discriminator's value on valueObject; missing or non-matching values fall back to index 0.

      Pure data transformation — no rendering concerns, no React imports.

      Parameters

      • options: readonly WalkedField[]
      • discriminator: string
      • valueObject: Record<string, unknown> | undefined

      Returns DiscriminatedActive