yaschema
    Preparing search index...

    Function makeStringSubtypeArray

    • Given a list of string literals and/or string subtype arrays, creates a typed, flattened array.

      For example:

      const x = makeStringSubtypeArray('one', 'two');
      type X = typeof x[0];
      const y = makeStringSubtypeArray(x, 'three');
      type Y = typeof y[0];

      In the above example:

      • the type of x is Array<'one' | 'two'>
      • the type of y is Array<'one' | 'two' | 'three'>

      and so:

      • 'X' is 'one' | 'two'
      • 'Y' is 'one' | 'two' | 'three'

      Type Parameters

      • T extends string

      Parameters

      Returns StringSubtypeArray<T>