What's the difference between Map and Record

Alexander Berndt picture Alexander Berndt · Jun 4, 2019 · Viewed 12.1k times · Source

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.

https://levelup.gitconnected.com/advanced-typescript-types-with-examples-1d144e4eda9e,

but typing Maps like this:

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

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

Answer