While I have some familiarity with TypeScript, there is one thing that continues to intrigue me. I understand the distinction between Array<string>
and string[]
. I am aware that these declarations can be used interchangeably, such as:
export class SomeClass {
someDeclaration: Array<SomeObject>;
otherDeclaration: SomeObject[];
}
However, in my recent work, I encountered a different declaration structure, like so:
export class OtherClass {
strangeDeclaration: [SomeObject];
}
My inquiry is: Is this an acceptable method of declaring an array? What sets it apart from the more conventional ways? Where does this particular structure originate from?