Running Typescript scratches in Webstorm IDE
Recently i started to work more closely with Typescript and therefore i need to test some small ideas more often in typescript. Scratches are the best place to do that while you're building something. Unfortunatelly Webstorm doesn't support running typescript scratches out of the box. It can only understand Js files. I wasn't excited about this, but i managed to find a quick solution to this. Hope it will help others as well.
- First we need to install
npm install -g ts-nodecommand
- Create typescript scratch in Webstorm IDE
Cmd + Shift + A->
- Create new Node configuration with next settings :
The key here is to specify
--require ts-node/register in
Node parameters section. This will tell IDE to transpile ts scratch file into js file and run it.
Thanks Elena Pogorelova for this tip !