Grab that Item-array and change it!

If you are in the rare pickle of having to destructure a TS-array to a single instance, here is what I think could help you. First, I’ll explain the problem.

Imagine an interface called `Order`. It’s defined like this:


While writing an application in Node, I was trying to test whether an object had certain properties (by lack of TypeScript, because this was a a very simple application).

The (now simplified) test looked like this.

Aart den Braber

Software developer with a passion for beautiful code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store