How to setup a typescript environment for your codewars locally

Setting up Typescript
Note: I have a preference to not install typescript globally and only per project. This setup utilizes vscode.
Create your project folder and navigate into it.
Create a sub folder "src", in your project folder, in which you will place your code.

in the integrated CLI, from your project folder, run the following command
yarn add -D typescript ts-nodeRun the following command in the CLI to initialize the typescript setup
npx tsc --initconfigure the generated tsconfig.json to your liking. Here are my settings for example.
{ "compilerOptions": { "target": "es2016" , "experimentalDecorators": true , "module": "CommonJS" , "rootDir": "./src" , "moduleResolution": "node" , "sourceMap": true , "outDir": "./dist" , "removeComments": true , "noEmitOnError": true , "esModuleInterop": true , "forceConsistentCasingInFileNames": true , "strict": true , "noUnusedLocals": true , "noUnusedParameters": true , "noImplicitReturns": true , "noImplicitOverride": true , "allowUnreachableCode": false , "skipLibCheck": true } }Set up debugging by opening debugger and create a new "launch.json" file.
"preLaunchTask": "tsc: build - tsconfig.json",Add the above line, above the "outFiles" line in "launch.json".

Finally to run your code, create a new typescript file, for example "myfile.ts", and from the CLI
npx ts-node ./src/myfile.tsThe output to your script will be in the terminal.
Optional: Setting up testing
- Install mocha and chai
yarn add -D chai mocha @types/chai @types/mocha Modify "package.json" add
"test": "mocha --require ts-node/register src/**/*.ts"to your scripts key.
For simplicity I write the solution and test in the same file. Note too that I name the test similarly to the solution being solved. This will come in handy for running single test.

Run the test
yarn test --grep "Reverse words"
I use the name of the test to run ONLY that single test. As we probably do not want to run all test.
All done.
Additionally you can set up a git repo to upload your work to a github or your remote git repository of choice.
