This solution is generated by ChatGPT, correctness is not guaranteed.
AI solution for TypeScript puzzle on BFE.dev
22. implement StringToTuple<T>
type StringToTuple<T extends string> = T extends `${infer F}${infer R}`
? [F, ...StringToTuple<R>] // add F to the tuple and recursively process R
: []; // terminate recursion if T is empty string
// Test cases
type A = StringToTuple<'BFE.dev'> // ['B', 'F', 'E', '.', 'd', 'e','v']
type B = StringToTuple<''> // []