Phil Nash

4 Steps from JavaScript to TypeScript

Migrate from JavaScript to TypeScript without the risky rewrite. This talk provides a practical, four-step blueprint for adopting it at your own pace.

4 Steps from JavaScript to TypeScript
#1about 4 minutes

Evaluating the pros and cons of TypeScript adoption

Consider the benefits of type safety and improved tooling against the costs of a learning curve and build overhead before migrating a project.

#2about 3 minutes

Step 1: Enable TypeScript type checking for JavaScript files

Use editor settings like `checkJs` or a `// @ts-check` comment to get immediate type feedback on your JavaScript code without any build changes.

#3about 5 minutes

Step 2: Introduce the TypeScript compiler with a minimal setup

Add TypeScript as a dependency and configure `tsconfig.json` with non-strict settings like `allowJs` to compile existing JavaScript without errors.

#4about 3 minutes

Step 3: Enable build-time type checking for JavaScript files

Activate `checkJs` in your `tsconfig.json` to enforce type safety during the build and install necessary `@types` packages for dependencies.

#5about 4 minutes

Leverage JS Doc for type safety in JavaScript

Add types to your JavaScript project using JS Doc comments, allowing TypeScript to provide strong typing without converting files to `.ts`.

#6about 5 minutes

Step 4: Incrementally convert JavaScript files to TypeScript

Gradually rename `.js` files to `.ts` one at a time, updating syntax from CommonJS to ES Modules and adding explicit types as you go.

#7about 2 minutes

Recap of the four-step JavaScript to TypeScript migration

Review the complete migration path, from enabling editor checks and introducing the compiler to incrementally converting files and adding types.

#8about 2 minutes

How to convince your team to adopt TypeScript

Demonstrate the value of TypeScript by enabling `checkJs` on an existing project to reveal hidden type-related issues as a practical proof point.

Related jobs
Jobs that call for the skills explored in this talk.

Angular Developer

Picnic Technologies B.V.
Amsterdam, Netherlands

Intermediate
Senior

Featured Partners

Related Articles

View all articles
DC
Daniel Cranney
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
JavaScript is the backbone of web development, powering everything from small websites to large-scale enterprise applications. However, as projects grow in complexity, maintaining JavaScript code can become increasingly difficult. This is where TypeS...
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
BR
Benjamin Ruschin
The HTML Elements That You’re Probably Over-Engineering
As frameworks have become more and more commonplace in the world of web development, so too has the over-engineering of features made possible by our humble old friend, HTML. The mental models that come with using state management in React, Vue and o...
The HTML Elements That You’re Probably Over-Engineering
S
SciChart
The Fastest JavaScript Charts - Built for React and Beyond
For most developers, browser charting works fine — until it doesn’t. Once you push beyond tens of thousands of points, add live streaming, or need advanced interactions, the story changes: frame drops, frozen dashboards, memory issues. That’s where S...
The Fastest JavaScript Charts - Built for React and Beyond

From learning to earning

Jobs that call for the skills explored in this talk.

TypeScript AWS Developer

TypeScript AWS Developer

TechShack
Charing Cross, United Kingdom

£156-182K
Senior
Terraform
TypeScript
Microservices
Amazon Web Services (AWS)