Skip to content

Inferring rest of array in a conditional results in unknown[] #45599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
minhpnz opened this issue Aug 27, 2021 · 1 comment
Closed

Inferring rest of array in a conditional results in unknown[] #45599

minhpnz opened this issue Aug 27, 2021 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@minhpnz
Copy link

minhpnz commented Aug 27, 2021

Bug Report

πŸ”Ž Search Terms

Conditional Array Rest Unknown

πŸ•— Version & Regression Information

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
#45281

I was unable to test this on prior versions than 4.1

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

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;
@jcalz
Copy link
Contributor

jcalz commented Aug 27, 2021

Um, d..duplicate of #45281. What am I missing here?

@minhpnz minhpnz closed this as completed Aug 27, 2021
@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants