Skip to content
Web Design & Development

TypeScript for Web Projects, Done Properly

A typed layer over JavaScript that checks types at build time and improves editor support.

MediaScaleUp Editorial Team 2 min read 12 views
TypeScript for Web Projects, Done Properly

The key figures

Compilation
TypeScript compiles to JavaScript
Strictness
compiler options control how strict checks are
Type definitions
libraries ship or require type packages
Runtime
types disappear at runtime and do not validate input

Why this is worth getting right

Types catch a class of bugs before runtime and document intent, at the cost of build complexity.

Do this, not that

Do

  • Enable strict mode on new projects
  • Type external data explicitly
  • Validate untrusted input at runtime too
  • Adopt gradually in existing codebases
  • Keep type definitions updated

Don’t

  • Using any everywhere
  • Assuming types validate API responses
  • Big-bang migrations
  • Type gymnastics that hurt readability

When to bring in help

Our advice Bring in help when migrating a JavaScript codebase.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development