Hey there! I'm having some trouble with Electron not supporting TypeScript on my setup. I'm using vscode 1.16.1 and here is an overview of my package.json:
{
[...]
"devDependencies": {
"electron": "^1.6.13",
"ts-loader": "~2.3.7",
"typescript": "~2.5.0",
"webpack": "^3.6.0",
[...]
}
}
In addition, I have a tsconfig.json file like this:
{
"compilerOptions": {
"module": "es6",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": [
"src/**/*"
]
}
and my webpack configuration looks something like this:
const path = require('path');
module.exports = [{
entry: './src/main.ts',
devtool: 'inline-source-map',
target: 'electron',
module: {
rules: [
{ test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/ }
]
},
node: {
__dirname: false,
__filename: false
},
resolve: {
extensions: [".ts", ".js"]
},
output: {
filename: 'electron_core.js',
path: path.resolve(__dirname, 'dist')
}
}
];
I found that adding the following line at the top of my main.ts file resolves the error:
///<reference path="../node_modules/electron/electron.d.ts" />
However, I would prefer to avoid these references if possible, as it doesn't seem necessary with the latest version of TypeScript. Any advice on how to work around this issue would be greatly appreciated!
Thank you!