实现一个通用的工具类型 FirstUniqueCharIndex<S>,该类型接受一个字符串 S,找到其中第一个不重复的字符并返回其索引。如果不存在这样的字符,则返回 -1。
FirstUniqueCharIndex<S>
S
-1
例如:
type FirstUniqueCharIndex<'abab'> // expected to be -1 type FirstUniqueCharIndex<'abcab'> // expected to be 2
TypeScript