📢 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!
Minimal TypeScript project setup for curious minds
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.
Project setup
git clone https://github.com/bobaekang/minimal-typescript-setup.git
cd minimal-typescript-setup
npm install
Project structure
/
/dist <- compiled JavaScript code goes here
/src <- TypeScript source code lives here
/test <- test files (**.test.ts) live here
Main dependencies
- 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 scripts
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 |