StudyPlayground / TypeScript-Exercise-Challenges

Typescript exercise & challenges
2 stars 0 forks source link

Type Challenges 296-Permutation #46

Open kscory opened 5 months ago

kscory commented 5 months ago

답안을 작성해주세요.

kscory commented 5 months ago

이번 것 어려워서 답지 참고 했습니다 ㅜ

type Permutation<T, C = T> = [T] extends [never] ? []
    : C extends infer U
        ? [U, ...Permutation<Exclude<T, U>>]
        : []
bananana0118 commented 5 months ago
type Permutation<T,K = T> = T[] extends never[]
?[] : K extends K 
? [K, ...Permutation<Exclude<T,K>>] : never 

엉엉엉엉엉엉엉엉

wogha95 commented 4 months ago

이런것도 가능하군요,,