Share via


SelectArray type

Se TFields non è mai, una matrice di stringhe non tipizzata In caso contrario, un tipo ristretto Fields[] da usare altrove nel tipo di utilizzo.

type SelectArray<TFields> = [string] extends [TFields]
  ? readonly TFields[]
  : () => (T extends TFields ? true : false) extends () => T extends never
      ? true
      : false
      ? readonly string[]
      : readonly TFields[]