DEV Community

Adam Coster
Adam Coster

Posted on • Updated on • Originally published at bscotch.net

 

Typescript Starter Kit: get up and running quickly!

As much as I love Typescript, I often find myself just using plain JavaScript for small projects because all the overhead of getting a Typescript environment setup just doesn't seem worth it.

Well, no more! I've put together a Typescript Starter Kit to make it infinitely easier to get new Typescript projects running.

GitHub logo bscotch / typescript-template

Typescript project starter that includes testing, linting, and changelogs, and is ready for publishing to npm

Features

  • A GitHub template to easily create your own remote repo based off of this one
  • Full step-by-step setup instructions in the README
  • All necessary dependencies built in and ready to go
  • Typescript config and matching file structure prepared so you can get right to coding
  • Ready for publishing to npm, with files properly included/excluded by default
  • Easy versioning, coupled to publishing to npm
  • Test suite template ready to populate
  • Test commands for VSCode built-in
  • Command line interface template for creating CLI tools

I hope this template helps you as much as it's going to help me!

Top comments (0)

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!