03062-medium-shift

Back

type Shift<T extends any[]> = T extends [infer F, ...infer Rest] ? Rest : []

Solution by wendao-liu #35220

// your answers

Solution by jiak-123 #35061

type Shift<T extends PropertyKey[]> = T extends [infer First,...infer Rest] ? [...Rest] : T

Solution by devshinthant #34949

// your answers
type Shift<T> = T extends [] ? []: T extends [infer F, ...infer L] ? L : never

Solution by gobielJonathan #34483

type Shift<T extends any[]> = T extends [infer V, ...infer rest] ? rest : T

Solution by ouzexi #34054

type Shift<T extends any[]> = T extends [unknown, ...infer X] ? X :[]

Solution by loevray #33377

type Shift<T extends any[]> = T extends [infer F, ...infer L] ? L : T extends [] ? [] : never;

Solution by ZhipengYang0605 #33223

// your answers
type Shift<T extends unknown[]> = T extends [infer L, ...infer R]? R:[]

Solution by pea-sys #32941

type Shift<T extends unknown[]> = T extends [infer _, ...infer R] ? R : []

Solution by dev-hobin #32523

type Shift<T extends any[]> = T extends [any, ...infer U] ? U : []

Solution by maximallain #32398



type Shift<T extends any[]> = T extends [any,...infer U] ? U : never 


Solution by rkamely #32102

type Shift<T extends unknown[]> = T extends [unknown, ...infer R] ? R : T;

Solution by ricky-fn #31908

type Shift<T extends any[]> = T extends [infer F, ...infer R] ? R : [];

Solution by vipulpathak113 #31781

type Shift<T extends any[]> = T extends [any, ...infer Rest] ? Rest : [];

Solution by kai-phan #31016

type Shift<T extends unknown[]> = T['length'] extends 0 ? [] : T extends [unknown, ...infer P] ? P : never; 

Solution by kanishev #30835

type Shift<T extends any[]> = T extends [any, ...infer U] ? U : never;

Solution by kanishev #29880

type Shift<T extends unknown[]> = T extends [unknown, ...infer R] ? R : T

Solution by dmytro-shumak #29244

type Shift<T extends unknown[]> = T extends [infer F, ...infer R] ? R : T;

Solution by DoubleWoodLin #28698

// your answers
type Shift<T> = T extends [infer First, ... infer Rest] ? [...Rest] : []

Solution by L1atte #28610

// your answers
type Shift<T extends unknown[]> = T extends [infer _, ...infer Rest] ? Rest : T

Solution by daiki-skm #28007

type Shift<T extends unknown[]> = T extends [infer _, ...infer Rest] ? Rest : T

Solution by jjswifty #27632

type Shift<T extends any[]> = T extends [infer F, ...infer R] ? R : [];

Solution by slemchik03 #27618

type Shift<T extends any[]> = T extends [infer F, ...infer O] ? O : [];

Solution by 8471919 #27588

type Shift<T extends any[]> = T extends [any, ...infer Next] ? Next : []

Solution by jiechliu #27446

type Shift<T extends any[]> = T extends [] ? [] : T extends [any,...infer U] ? U : never

Solution by ZhipengYang0605 #27250

type Shift<T extends any[]> = T extends [infer L, ...infer R] ? R: []

Solution by isntkyu #27184

type Shift<T extends any[]> = T extends [infer _, ...infer R] ? R : []

Solution by smileboyi #26960

type Shift<T extends unknown[]> = T extends [infer _, ...infer R] ? R : never;

Solution by ryuji-1to #26880

type Shift<T extends unknown[]> = T extends [infer _, ...infer Rest]
  ? Rest
  : []

Solution by HaoxueAllen #26532

type Shift<T extends unknown[]> = T extends [infer Head, ...infer Tail] ? Tail : []

Solution by ScarboroughCoral #26469