0

Apologies about the elementary question. I am wondering about this specific bracket notation I found in a function in Typescript:

const results = await getAllUsers();
  const totalUsers = await getUserCount();
  const firstUser = await getFirstUser();

  return {
    props: {
      meta: defaultMetaProps,
      results,
      totalUsers,
      user: firstUser
    },
    revalidate: 10
  };

From what I can tell online, the main way to use brackets in Typescript is to specify properties of objects, like:

props = {
  a: 'a',
  b: 'b'
}

However, I am confused because this set of lines does not seem to follow that convention:

props: {
      meta: defaultMetaProps,
      results,
      totalUsers,
      user: firstUser
    }

Specifically, results and totalUsers don't have corresponding property names. Am I misinterpreting something?

Victor M
  • 603
  • 4
  • 22
  • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#property_definitions – siride Dec 10 '22 at 19:22

0 Answers0