-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Description
3060 - Unshift
Silence before the storm. This challenge is nearly identical to the previous (Push), but after this the heat gets turned up quite considerably. Get ready! Enjoy your day off with this challenge.
🎥 Video Explanation
🔢 Code
import type { Equal, Expect } from './test-utils'
type A1 = Unshift<[], 1>;
type B1 = [1];
type C1 = Expect<Equal<A1, B1>>;
type A2 = Unshift<[1, 2], 0>;
type B2 = [0, 1, 2];
type C2 = Expect<Equal<A2, B2>>;
type A3 = Unshift<['1', 2, '3'], boolean>;
type B3 = [boolean, '1', 2, '3'];
type C3 = Expect<Equal<A3, B3>>;
// ============= Your Code Here =============
type Unshift<T extends unknown [], U> = [U, ...T];➕ More Solutions
For more video solutions to other challenges: see the umbrella list! #21338
Metadata
Metadata
Assignees
Labels
No labels