Type Alias NoRepetition<U, ResultT>

NoRepetition:
    | ResultT
    | { [k in U]: NoRepetition<Exclude<U, k>, [k, ...ResultT]> }[U]

Creates a type that represents a string with no repeated characters.

Type Parameters

  • U extends string

    The string to process.

  • ResultT extends any[] = []

    The result type, defaulting to an empty array.

type Original = NoRepetition<"abc">; // ["a", "b", "c"]