ts.data.json - v4.2.1
    Preparing search index...

    Function oneOf

    • Decoder that returns the first alternative to succeed.

      The output type is inferred as the union of the alternatives. Pass an explicit type argument when you want to state the target type instead.

      Type Parameters

      • T

      Parameters

      Returns Decoder<T>

      oneOf([string(), number()]); // Decoder<string | number>
      
    • Decoder that returns the first alternative to succeed.

      The output type is inferred as the union of the alternatives. Pass an explicit type argument when you want to state the target type instead.

      Type Parameters

      Parameters

      • decoders: D

      Returns Decoder<OutputOf<D[number]>>

      oneOf([string(), number()]); // Decoder<string | number>