What's the Difference Between Map and Record [Duplicate]

I don't quite get what the difference between Map and Record in Typescript is.

The only comparison I found was

A very useful built-in type introduced by Typescript 2.1 is Record: it allows you to create a typed map and is great for creating composite interfaces.

,

but typing Maps like this:

const testMap = new Map<number, string>();

also works, so I don't really understand the difference.

1
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest