type-challenges / type-challenges

Collection of TypeScript type challenges with online judge

Home Page:https://tsch.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

8987 - Subsequence

sunupupup opened this issue · comments

type Subsequence<Arr extends any[], SubArr extends any[] = []> =
Arr extends [infer Fisrt, ... infer Rest extends any[]]
    ? SubArr | Subsequence<Rest, [...SubArr] > | Subsequence<Rest, [...SubArr, Fisrt] >
    : SubArr