electron: TypeScript translation broken for NodeJS.Process
- Electron version: 1.7.2 beta
- Operating system: All
Expected behavior
// Should compile successfully.
process.on('uncaughtException', recordException);
Actual behavior
// Fails to compile because electron.d.ts overrides the `on` method.
process.on('uncaughtException', recordException);
How to reproduce
Update the repo to electron 1.7.2. Use TypeScript. Create a module and copy/paste the code snippet above. If using an IDE with TypeScript IntelliSense (i.e. Visual Studio Code), the ‘uncaughtException’ will produce the following error
[ts] Argument of type ‘“uncaughtException”’ is not assignable to parameter of type ‘“loaded”’.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 11
- Comments: 23 (11 by maintainers)
My workaround for now:
Thanks for sharing your workaround, @eanders-MS. We’ll get this sorted soon. 👍
Similarly, In 1.7.2, the ‘exit’ event is no longer part of NodeJS.Process. Compiling this TypeScript:
results in this error: error TS2345: Argument of type ‘“exit”’ is not assignable to parameter of type ‘“loaded”’.
I don’t know how I ended up here, but this is definitely working in Electron 12