Home > Software design >  How To Convert all values of A Typescript Record into a single Array?
How To Convert all values of A Typescript Record into a single Array?

Time:01-07

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.

CodePudding user response:

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

TS Playground

  • Related