๐ข NOTE: If your goal is to simply learn and play with TypeScript, which is what this repo was created to facilitate, just use Deno ๐ฆ. Deno is a new JavaScript runtime that supports TypeScript out of the box, ships as a single executable, has built-in support for linting, formatting and testing, and offers even more!
This repository contains a simple setup for Node.js project with TypeScript. Feel free to take a look around the source code and step-by-step commit history, clone and fork the repo to try it out, and open Issues to share your suggestions for improvements.
Please refer to this blog post for a detailed explanation.
git clone https://github.com/bobaekang/minimal-typescript-setup.git
cd minimal-typescript-setup
npm install
/
/dist <- compiled JavaScript code goes here
/src <- TypeScript source code lives here
/test <- test files (**.test.ts) live here
- TypeScript
ts-node
for development server- ESLint for linting
typescript-eslint
for ESLint plugins to support TypeScript- Prettier for formatting source code
- Mocha for testing
npm script | description |
---|---|
build |
Compile TypeScript source code to JavaScript |
lint |
Typecheck, lint and format TypeScript source code |
serve |
Run TypeScript source code directly with ts-node |
start |
Run compiled JavaScript code |
test |
Run tests with Mocha |