This seems like a TypeScript bug, but I'm not 100% sure.
If you see the example below, I'm expecting two errors (in gameData, highlighted by comments) but TypeScript intellisense will only highlight one of them.
If you comment out either of them, the other will error, but never both of them.
Does anyone know if there's a reason for this? Or if it's a bug?
interface Saved {
highScore?: number;
levelsComplete?: number;
}
interface GameData {
score: number;
timeTaken?: number;
saved?: Saved;
}
const gameData: GameData = {
score: 0,
timeTaken: 60,
saved: [1, 2, 3], // this should error as it does not match Saved - if this is commented out, 'averageScore' now errors
averageScore: 10, // this property doesn't exist on GameData and should also error
};