The first step in converting your JavaScript project to TypeScript is renaming your JavaScript files. For each .js
file in your src
directory, rename it to .ts
. For example, index.js
should become index.ts
.
Once you rename your files, TypeScript will start highlighting type errors. Initially, you might see a lot of errors since TypeScript will try to infer types based on existing JavaScript code. To resolve these: