Open tacolegs2004 opened 8 months ago
A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.
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;
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: