Creating Typescript Starter Project with Jest and Typedoc


For our prototyping work we want a Typescript starter project preconfigured with Jest, Typedoc, and NPM Workflow Scripts.

Cloning it like this creates the project <project_name>:

git clone <project_name>

This is the final repository in case you want to get right to it:


First create a new Node project:

mkdir typescript-starter
cd typescript-starter
npm init -y

This initializes package.json for us.

NPM Workflow Scripts

The below install-devdeps will install the latest development dependencies needed:

"install-devdeps": "npm i -D typescript typedoc ts-node ts-jest source-map-support @types/node jest @types/jest"

The types/node package from provides access to types for the node APIs like file , process and so on.

The script install-tools install the latest development workflow packages:

"install-tools": "npm i -g del-cli npm-install-peers npm-check-updates @jsdevtools/version-bump-prompt http-server"

The script update will update the dependency versions and install them and the newer versions of peer dependencies:

"update": "ncu -u && npm i && npm-install-peers"

The pub script bumps the patch version and publishes the project to NPM:

"pub": "npm t && bump patch && npm run update && npm run build && npm publish"

The test script runs Jest:

"test": "jest"

The build script runs the build:

"build": "del-cli dist && tsc"

The doc script runs Typedoc:

"doc": "del-cli doc && typedoc --entryPointStrategy expand ./src/ --out doc --exclude **/*.spec.ts"

And the sdoc script runs Typedoc and serves up the results:

"sdoc": "npm run doc && http-server -o doc"

Typescript files are written to the doc directory.

Jest Configuration

We will be using this Jest configuration (jest.config.js):

Typescript Configuration

Our Typescript configuration is as follows:

Commit to Github

Create the Github repository fireflysemantics/typescript-starter .

Then add, commit, and push the files.

git add .
git commit -m "First Commit"
git remote add origin
git push --set-upstream origin master

Test Project Creation

We can now tryout the instructions for the project:

git clone <project_name>cd <project_name>npm run install-allnpm test

Founder of Firefly Semantics Corporation

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How I Used My ZX81 to Draw the Iconic OP Logo

Top 10 Node.js Frameworks For Web App Development in 2020-21

Supercharging your console logs in React Native


Implementing Debounce in JS

Why and when you should use console.error()

Top Node.js Frameworks For Web Apps In 2022

Promise.all() v. Promise.allSettled() for Multiple Asynchronous Operations

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation

More from Medium

JavaScript Control Flow & Error Handling

I built a tool to curate my own code template library

Build CRUD on RESTful API with MongoDB — Javascript, Part2— Setup the project.

You Can’t Use Fetch In Node Js