No. 244 · Hard · template literal types
Repeat
Implement `Repeat<S, N>` so it concatenates the string `S` exactly `N` times. Repeating zero times gives the empty string.
Puzzle
repeat-string.tsStroke 1 of 4Not run yet
Replace ??? — your solution is checked against the cases below. Tab indents; press Escape then Tab to move focus out.
Checks
4Repeat<'ab', 3>—→ 'ababab'Repeat<'x', 0>—→ ''Repeat<'x', 1>—→ 'x'Repeat<'-', 5>—→ '-----'
How a check is judged Exact type equality, not assignability — an intersection is not the same as the flattened object.
How everyone did
Fewer than 5 people have solved this one so far. The distribution appears once there is enough of a sample to mean anything.
Short game
Fewest charactersNo public scores yet.
