/typescript-starter

A basic starter setup for new typescript projects

Primary LanguageTypeScript

TypeScript Starter

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

Setup steps:

  1. Install Node.js
  2. Make sure you have npm installed (this should be bundled with Node.js). You can check by running npm -v
  3. Clone this repo and cd into it
  4. Run npm install
  5. Run npm run -s prepare

Testing

To run the tests in watch mode, run:

npm -s test

Linting

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

TypeChecking

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

Running as a script

To run the index.ts file as a script run:

npm -s start