Chrillewoodz Chrillewoodz - 1 month ago 6
TypeScript Question

TypeScript what is the difference between any[] and Array<any> and when should I use which one?

I'm a bit confused when it comes to defining arrays in TypeScript, because I don't understand the difference between

any[]
and
Array<any>
.

I read this question in hope to gain some understanding, but it didn't enlighten me. And I can't seem to find any general sources that describes this.

When should I be using
any[]
and when should I use
Array<any>
? Does it even matter which one I use?

Answer

There is no difference to the generated Javascript. It's a matter of style.