<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vikrant Kukadiya on Medium]]></title>
        <description><![CDATA[Stories by Vikrant Kukadiya on Medium]]></description>
        <link>https://medium.com/@kukadiyavikrant?source=rss-52a12284603c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kApERVP_OIqerxf6aO_mXw.jpeg</url>
            <title>Stories by Vikrant Kukadiya on Medium</title>
            <link>https://medium.com/@kukadiyavikrant?source=rss-52a12284603c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:40:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kukadiyavikrant/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Easy Guide: Converting Your JavaScript Project to TypeScript with ts-migrate]]></title>
            <link>https://medium.com/simform-engineering/easy-guide-converting-your-javascript-project-to-typescript-with-ts-migrate-1a69f5f36d2a?source=rss-52a12284603c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a69f5f36d2a</guid>
            <category><![CDATA[ts-migrate]]></category>
            <category><![CDATA[js-to-ts]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Vikrant Kukadiya]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 07:33:15 GMT</pubDate>
            <atom:updated>2025-11-19T07:33:15.414Z</atom:updated>
            <content:encoded><![CDATA[<h4>A practical workflow for gradually upgrading JavaScript to TypeScript using ts-migrate</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UN064yThUf1rjOtS_vM-2A.png" /></figure><p>If you’re a developer working on a frontend application, you’ve probably heard of TypeScript and its benefits, such as static typing, better tooling, and improved code quality. Converting your existing JavaScript (JS) project to TypeScript (TS) can be a daunting task, but fear not, because <a href="https://github.com/airbnb/ts-migrate"><strong><em>ts-migrate</em></strong></a> is here to make the transition smoother.</p><p><a href="https://github.com/airbnb/ts-migrate"><strong><em>ts-migrate</em></strong></a> is a powerful tool designed by <strong>Airbnb</strong> to help you migrate your frontend application from JavaScript to TypeScript. In this guide, we will walk you through the process of converting your project step by step.</p><h3>Installing ts-migrate</h3><p>Before you can start migrating your project, you need to install <a href="https://github.com/airbnb/ts-migrate"><strong><em>ts-migrate</em></strong></a> as a development dependency. You can do this using <strong>npm</strong> or <strong>yarn:</strong></p><pre>npm install --save-dev ts-migrate<br>or<br>yarn add --dev ts-migrate</pre><p>With <a href="https://github.com/airbnb/ts-migrate"><strong><em>ts-migrate</em></strong></a> installed, you’re ready to start converting your project to TypeScript.</p><h3>Migrating Your Entire Project</h3><p>The easiest way to migrate your entire project is by using the ts-migrate-full command. This command will perform a comprehensive migration of your project and even handle Git commits after each major step. Here&#39;s how to run it:</p><pre>npx -p ts-migrate -c &quot;ts-migrate-full &lt;folder&gt;&quot;</pre><p>Replace &lt;folder&gt; with the path to your project&#39;s root directory. Be patient; migrating an entire project can take some time.</p><h3>Migrating Specific Parts of Your Project</h3><p>In some cases, you may want to migrate only specific parts of your project, such as a subset of your sources or global types. You can achieve this by specifying the sources you want to migrate using the --sources flag. Here&#39;s an example:</p><pre>npx ts-migrate-full &lt;folder&gt; /<br>  --sources=&quot;relative/path/to/subset/**/*&quot; /<br>  --sources=&quot;node_modules/**/*.d.ts&quot;</pre><p>In the above command, we’re specifying both a subset of our project to migrate and global type declarations in the node_modules directory.</p><h3>Individual CLI Commands</h3><p>If you prefer a more granular approach to migration, <strong><em>ts-migrate</em></strong> offers individual CLI commands to perform specific tasks. Here are some of the available commands:</p><ul><li>init: Initialize a tsconfig.json file in your project.</li><li>rename: Rename files in your project from JS/JSX to TS/TSX.</li><li>migrate: Fix TypeScript errors using codemods.</li><li>reignore: Re-run ts-ignore on your project.</li></ul><p>You can use these commands as follows:</p><pre>npx ts-migrate -- init &lt;folder&gt;<br>npx ts-migrate -- rename &lt;folder&gt;<br>npx ts-migrate -- migrate &lt;folder&gt;<br>npx ts-migrate -- reignore &lt;folder&gt;</pre><h3>Reignore: Making Your Project Compilable</h3><p>In situations where you’ve made significant changes to your project, such as updating common libraries or improving types, you might encounter numerous TypeScript compilation errors. You have two options:</p><ol><li>Fix all the errors, which can be time-consuming.</li><li>Make the project compilable and fix errors gradually.</li></ol><p>For the second option, <strong><em>ts-migrate</em></strong> provides a reignore script that can automate the process of adding any or @ts-expect-error (@ts-ignore) comments to problematic places in your code, making your project compilable. You can run it using the following command:</p><pre>npx ts-migrate -- reignore</pre><h3>Using --sources for Partial Migrations</h3><p>Migrating an entire project might be a big step for some teams. If that’s the case, you can use the --sources flag to perform partial migrations on specific parts of your project. This flag allows you to override the default sources specified in your tsconfig.json. Here&#39;s how to use it:</p><pre>npx ts-migrate-full /path/to/your/project --sources &quot;some/components/**/*&quot;<br>npx ts-migrate -- rename /path/to/your/project -s &quot;some/components/**/*&quot;</pre><p>Make sure to include any ambient type files your project uses to prevent ts-migrate from marking unidentifiable globals as type errors.</p><h3>Introducing ts-migrate-plugins</h3><p><a href="https://www.npmjs.com/package/ts-migrate-plugins"><strong><em>ts-migrate-plugins</em></strong></a> is a set of customizable plugins designed to work seamlessly with <strong><em>ts-migrate</em></strong>. These plugins, or codemods, perform the transformation of JS/JSX to TS/TSX.</p><h3>Installing ts-migrate-plugins</h3><p>You can install <a href="https://www.npmjs.com/package/ts-migrate-plugins"><strong><em>ts-migrate-plugins</em></strong></a> as a development dependency using npm or yarn:</p><pre>npm install --save-dev ts-migrate-plugins<br>or<br>yarn add --dev ts-migrate-plugins</pre><p><strong>Using ts-migrate-plugins:</strong></p><p>To use <em>ts-migrate-plugins</em> in your project, you’ll need to import the necessary modules and configure your migration. Here’s an example:</p><pre>import path from &#39;path&#39;;<br>import { tsIgnorePlugin } from &#39;ts-migrate-plugins&#39;;<br>import { migrate, MigrateConfig } from &#39;ts-migrate-server&#39;;<br><br>// Get the input files folder<br>const inputDir = path.resolve(__dirname, &#39;input&#39;);<br><br>// Create a new migration config and add ts-ignore plugin with empty options<br>const config = new MigrateConfig().addPlugin(tsIgnorePlugin, {});<br><br>// Run the migration<br>const exitCode = await migrate({ rootDir: inputDir, config });<br><br>process.exit(exitCode);</pre><h3>List of Available ts-migrate-plugins</h3><p><strong><em>ts-migrate-plugins</em></strong> offers a variety of plugins to handle different aspects of migration. Here’s a list of some available plugins:</p><ul><li><strong>add-conversions</strong>: Add conversions to any ($TSFixMe) in the case of type errors.</li><li><strong>declare-missing-class-properties</strong>: Declare missing class properties.</li><li><strong>eslint-fix</strong>: Run eslint fix to correct any eslint violations.</li><li><strong>explicit-any</strong>: Annotate variables with any ($TSFixMe) in the case of any implicit violation.</li><li><strong>hoist-class-statics</strong>: Hoist static class members into the class body.</li><li><strong>jsdoc</strong>: Convert JSDoc @param types to TypeScript annotations.</li><li><strong>member-accessibility</strong>: Add accessibility modifiers (private, protected, or public) to class members according to naming conventions.</li><li><strong>react-class-lifecycle-methods</strong>: Annotate React lifecycle method types.</li><li><strong>react-class-state</strong>: Declare React state types.</li><li><strong>react-default-props</strong>: Annotate React default props.</li><li><strong>react-props</strong>: Convert React prop types to TypeScript types.</li><li><strong>react-shape</strong>: Convert prop types shapes to TypeScript types.</li><li><strong>strip-ts-ignore</strong>: Strip // @ts-ignore comments.</li><li><strong>ts-ignore</strong>: Add // @ts-ignore comments for the remaining errors.</li></ul><h3>Types of ts-migrate-plugins</h3><p>There are three main categories of ts-migrate-plugins:</p><ol><li><strong>Text-based plugins</strong>: These plugins operate on the text of source files and make transformations based on the source code text.</li><li><strong>Jscodeshift-based plugins</strong>: These plugins use the jscodeshift toolkit as a base for operations and transformations around the Abstract Syntax Tree (AST).</li><li><strong>TypeScript AST-based plugins</strong>: These plugins parse the AST with the TypeScript compiler API, generating a list of updates for the source code text and applying them to the source file.</li></ol><p>Migrating your JavaScript project to TypeScript with<strong> </strong><a href="https://github.com/airbnb/ts-migrate"><strong><em>ts-migrate</em></strong></a><strong><em> </em></strong>and <a href="https://www.npmjs.com/package/ts-migrate-plugins"><strong><em>ts-migrate-plugins</em></strong></a> is a manageable task. Whether you want to perform a full migration or tackle it in smaller steps, these tools provide the flexibility and automation needed to make the transition smoother.</p><p>Happy coding with TypeScript!</p><blockquote><strong><em>For more updates on the latest tools and technologies, follow the </em></strong><a href="https://medium.com/simform-engineering"><strong><em>Simform Engineering</em></strong></a><strong><em> blog.</em></strong></blockquote><blockquote><strong><em>Follow Us: </em></strong><a href="https://twitter.com/simform"><strong><em>X</em></strong></a><strong><em> | </em></strong><a href="https://www.linkedin.com/company/simform/"><strong><em>LinkedIn</em></strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a69f5f36d2a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/simform-engineering/easy-guide-converting-your-javascript-project-to-typescript-with-ts-migrate-1a69f5f36d2a">Easy Guide: Converting Your JavaScript Project to TypeScript with ts-migrate</a> was originally published in <a href="https://medium.com/simform-engineering">Simform Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>