C.W.K.
Stream
Quiz · 3 questions

📐 Arrays & Tuples — Where Position Matters

T[], Array<T>, tuples, readonly modifiers, as const, variadic tuples

Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete

Quiz

01What's the difference between string[] and [string, string]?
Hint
Hover both: const a: string[] = ['hi'] and const b: [string, string] = ['hi', 'there']. The shapes are different.
02What does as const do to an array literal?
Hint
Try both and hover: const colors = ['red', 'blue'] vs const colors = ['red', 'blue'] as const. The inferred types are very different.
03What problem do variadic tuples solve?
Hint
Variadic tuples are the reason RxJS, Redux Toolkit, and the modern TypeScript-aware versions of util libraries finally have proper types for compose/pipe.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.