94. 数组字符串元素匹配下标
中等
实现一个通用的工具类型 FindAll<T, P> ,它接收一个模式字符串 P 和一个文本字符串 T ,并返回一个数组,其中包含所有与 P 匹配的 T 的索引(以 0 为索引)。
例如:
type Res1 = FindAll<'Collection of TypeScript type challenges', 'Type'> // expected to be [14]
type Res2 = FindAll<'AAAA', 'AA'> // expected to be [0, 1, 2]