Skip to content
Advertisement

Crating a type of array of multiple objects

I want to create a type for an array of objects. The array of objects can look like this:

JavaScript

the type i am trying to use is:

JavaScript

Then i want to use the type like this:

JavaScript

but i get this error:

JavaScript

I can do something like this:

JavaScript

but lets say my array of object will have 100 objects in the array.

Advertisement

Answer

When setting a type for an array it should in this format any[].

So in your case

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement