Electron now supports typescript. But by running the example published in:
Electron official blog.
I always get the following error:
Should I have done something else?
The support that they have for Typescript is that they provide definition files. At runtime you still have to run Javascript. Compile the Typescript to Javascript and then use the resulting .js file as your entry point.
Install ts-node
and typescript
package to your project and then add parameter -r ts-node/register
when running electron
npm install ts-node
npm install typescript
electron -r ts-node/register .
and add require('ts-node/register')
in your html file
<script>
require('ts-node/register')
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With