Avatar ·

What is Record<K, V> in TypeScript and how to use it?

Hello! I started learning TypeScript and came across the `Record` type. Honestly, I don't fully understand what it's for and how it differs from a regular object or interface. Let's say I have this code: ```typescript interface User { id: number; name: string; } const users: { [key: number]: User } = { 1: { id: 1, name: 'Anna' }, 2: { id: 2, name: 'Boris' } }; ``` I see that I can write `{ [key: number]: User }`. But in the documentation I encountered `Record`. Is this the same thing? Or are there nuances? Also, I tried to create an object where the keys are strings that can only be specific values, for example, order statuses: 'pending', 'shipped', 'delivered'. I want the keys to be strictly from this set, and the values to be a date (string). Ka