This is a basic starter setup for new TypeScript projects.
It is configured with some tools that I like to use: TypeScript (in strict mode) for the benefits of static types, jest for testing, and eslint (with strict type rules) for linting, prettier for formatting.
Setup steps:
- Install Node.js
- Make sure you have
npm
installed (this should be bundled with Node.js). You can check by runningnpm -v
- Clone this repo and cd into it
- Run
npm install
- Run
npm run -s prepare
To run the tests in watch mode, run:
npm -s test
If you install an eslint plugin in your editor you should be able to see lint errors inline next to your code. You can also run eslint from the command line with npm run -s lint
You should be able to configure your editor to show TypeScript type errors inline. Alternatively, you can run the type checker from the command line with:
npm run -s typecheck
To run the index.ts file as a script run:
npm -s start