In TypeScript I have a class Foo
class Foo {}
I want array of instances of Foo. What is the difference between
var foos : Array<Foo>;
and
var foos : Foo[];
It seems to me that both define array of instances of given type, is there any difference at all?
EDIT: What are the names of these constructs? How do I correctly refer to them?
They are both identical as type annotations, so you can use whichever you prefer.
The Array syntax has only been available since generics were added.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With