There are (at least) 2 ways to define an array in Typescript. To the best of my knowledge they both do the same thing with differing syntax.
Imagine we have the following type definitions
type Post = {
content: string
}
type User = {
posts: Array<Post>,
other_posts: Post[]
}
We can define an array of Post
by using Array<Post>
or Post[]
.
For purely syntactic reasons I lean towards Array<Post>
as I read it as βan Array
of Post
objectsβ