Open
Description
Bug Report
π Search Terms
infer conditional array rest unknown
π Version & Regression Information
- I was unable to test this on prior versions than 4.1 because it uses template literal types added in 4.1
β― Playground Link
Playground link with relevant code
π» Code
Using code from the #40336 description restricted to strings only:
type Join<S extends string[], D extends string> =
S extends [] ? '' :
S extends [string] ? `${S[0]}` :
S extends [string, ...infer R] ? `${S[0]}${D}${Join<R, D>}` :
string;
π Actual behavior
R
is inferred as being unknown[]
.
π Expected behavior
R
should be inferred as being string[]
.