typescriptreact-typescript

How To Convert all values of A Typescript Record into a single Array?


Even if the question seems simple to me, I couldn't find an appropriate similar question on StackOverflow to mine.

I want to convert a Typescript Record<string, number> into a single number[] Array.

What is the easiest way possible to do that? I am searching for some kind of flatMap functionality.


Solution

  • Object.values() sounds like it would be what you're looking for. Object.values() on MDN

    TS Playground