09142-medium-checkrepeatedchars
Medium
union
string

Implement type CheckRepeatedChars<S> which will return whether type S contains duplicated chars?

For example:

type CheckRepeatedChars<'abc'>   // false
type CheckRepeatedChars<'aba'>   // true

Loading...
import type { Equal, Expect } from '@type-challenges/utils'

type cases = [
  Expect<Equal<CheckRepeatedChars<'abc'>, false>>,
  Expect<Equal<CheckRepeatedChars<'abb'>, true>>,
  Expect<Equal<CheckRepeatedChars<'cbc'>, true>>,
  Expect<Equal<CheckRepeatedChars<''>, false>>,
]