Created
December 1, 2025 04:16
-
-
Save anztrax/da5422442384d40174962d9a5817eb9f to your computer and use it in GitHub Desktop.
Implement Pop utils in Typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* _____________ Your Code Here _____________ */ | |
| type Pop<T extends any[]> = T extends [...infer P, any] ? P: []; | |
| /* _____________ Test Cases _____________ */ | |
| import type { Equal, Expect } from '@type-challenges/utils' | |
| type cases = [ | |
| Expect<Equal<Pop<[3, 2, 1]>, [3, 2]>>, | |
| Expect<Equal<Pop<['a', 'b', 'c', 'd']>, ['a', 'b', 'c']>>, | |
| Expect<Equal<Pop<[]>, []>>, | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment