Square brackets around vs after expression in Typescript

0 votes

The following two Typescript square bracket notations—are there any differences between them? Attempted a few situations, and it appears they are equivalent.

I'm grateful.

interface test {
  a: string;
  b: string;
}

const x: test[] = [{a: "aaaa", b: "bbbb"}]

const y: [test] = [{a: "aaaa", b: "bbbb"}]
Jul 29, 2022 in TypeSript by Tejashwini
• 3,820 points

edited Mar 4 8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP