I am diving into Typescript/Electron and attempting to create a text-based game. My journey began with a basic Electron application and I started implementing core logic using classes/interfaces that reference classes I have yet to implement. The snippet of my code looks something like this (Player does not reference any other classes)
import { app, BrowserWindow } from 'electron';
import { Player } from './Character/Player';
export default class Main {
static mainWindow: Electron.BrowserWindow;
static application: Electron.App;
static main() {
Main.application = app;
Main.application.whenReady().then(() => {
Main.mainWindow = new BrowserWindow({ width: 800, height: 600 });
Main.mainWindow.loadFile('../html/index.html');
let p : Player = new Player('Hero');
p.callName();
//Game.start();
})
}
}
Main.main();
and execute it using
npm run start
but encounter errors like
src/ts/Interfaces/Character.ts:16:9 - error TS2304: Cannot find name 'Shape'.
Now, I want to test sections of my code by commenting out all calls and imports to other classes, yet I still face compilation errors.
I attempted adding
"allowUnreachableCode": true,
to my tsconfig.jsonI also tried running npm with
npm run start || true
How can I get the application to execute and disregard unreachable (un-compilable) code without needing to make them compilable or commenting out everything?