CheckRepeatedChars
约 92 字小于 1 分钟
2026-02-11
题目
判断一个string类型中是否有相同的字符
type CheckRepeatedChars<'abc'> // false
type CheckRepeatedChars<'aba'> // true解题思路
待补充
答案
type CheckRepeatedChars<T extends string> = any验证
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>>,
]参考
无
