-
Couldn't load subscription status.
- Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolution
Milestone
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[].
supposedly, nag, dan-cooke and hstevanoskiwebNeat, cypherfunc and nag
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolution