Array VS Type[] in Typescript

As far as I know a property’s type can be defined in two ways when it’s an Array.

property_name: type

where type can be either

Array<string>, Array<MyType>, etc. (e.g. let prop1: Array<string>)

and

string[], MyType[], etc. (e.g. let prop1: string[])

What is the difference between the two cases? Or am I misunderstanding something (perhaps something about <> used in casting?)

EDIT since the question is marked as duplicate, I am aware there is the other question about any[] but still I had a look at it before posting and to me it was more about the type ‘any’ than the different [] VS <> I asked

2 Answers
2

Leave a Comment