mattpocock / ts-error-translator

VSCode extension to turn TypeScript errors into plain English
https://ts-error-translator.vercel.app
2.36k stars 90 forks source link

Translation request for 1355 #245

Open tacolegs2004 opened 8 months ago

tacolegs2004 commented 8 months ago

Error Text

A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.

Supporting Information

I was mucking around with Github Copilot when I came across this error.

Here is the code that led to this error:

const games = {
  action: [
    {
      name: "GTA V",
      price: 100,
      releaseDate: new Date("2013-09-17"),
      dlc: true,
    },
  ],
  adventure: [
    {
      name: "The Witcher 3",
      price: 150,
      releaseDate: new Date("2015-05-19"),
      dlc: true,
    },
  ],
  rpg: [
    {
      name: "Dark Souls 3",
      price: 200,
      releaseDate: new Date("2016-04-12"),
      dlc: true,
    },
  ],
};

const game = games.adventure.map((game) => game);

const gta = game[0].name as const;