How can I run a Typescript Scratchfile?
Hi guys,
new Webstorm User. Enjoying it so far.
I played around with a scratch.ts file and I figured out there is no run scratch file option. Only when I manually compile it with `tsc scratch.ts` and generate a `scratch.js` file. Only then can I run it.
Is there really no way to run .ts file directly in the scratchfile?
Please send help.
Greets Geralt
Please sign in to leave a comment.
Typescript scratch files can't be run for the same reason as non-scratch .ts files: Typescript can't be executed directly, it has to be transpiled to JavaScript first.
You can try using
--require ts-node/registerin your run configuration, like:of course, you have to install
ts-nodein your project firstI added "--require ts-node/register" to the Options field in Webstorm (Mac) and I must not be understanding the above solution, because when I invoke the transpileer I do not get a .js file.
What is it I am failing to understand?
You have to add this option to your run configuration, not to the Typescript compiler service options