Log in to GraphQL EditorGet started
Docs
Introduction
Desktop app
External Tools
CLI

Aliases | Zeus GraphQL TypeScript generator

Zeus supports declaring aliases by using:

const aliasedQueryExecute = await chain('query')({
  listCards: {
    __alias: {
      atak: {
        attack: [
          { cardID: ['1'] },
          {
            name: true,
            description: true,
          },
        ],
      },
    },
  },
});

and this is the response:

{
  "listCards": [
    {
      "atak": [
        {
          "name": "Zelma",
          "description": "Central"
        }
      ]
    }
  ]
}

Now you can access properties in a type-safe way like this:

aliasedQueryExecute.listCards.map((c) => c.atak);