-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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[].
Reactions are currently unavailable
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