<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: i-am-killvish</title>
    <description>The latest articles on Forem by i-am-killvish (@iamkillvish).</description>
    <link>https://forem.com/iamkillvish</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3896833%2F6855fff4-8708-4764-9354-c9c245af8018.png</url>
      <title>Forem: i-am-killvish</title>
      <link>https://forem.com/iamkillvish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/iamkillvish"/>
    <language>en</language>
    <item>
      <title>Extending my TypeScript auto-fix CLI to handle .filter(Boolean) narrowing issues</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Mon, 04 May 2026 16:29:23 +0000</pubDate>
      <link>https://forem.com/iamkillvish/extending-my-typescript-auto-fix-cli-to-handle-filterboolean-narrowing-issues-21cd</link>
      <guid>https://forem.com/iamkillvish/extending-my-typescript-auto-fix-cli-to-handle-filterboolean-narrowing-issues-21cd</guid>
      <description>&lt;p&gt;A few days ago I shared a small CLI experiment called &lt;code&gt;fixmyfile&lt;/code&gt; that automatically fixes repetitive TypeScript errors using compiler diagnostics and AST transformations.&lt;/p&gt;

&lt;p&gt;While testing it more, I kept running into another frustrating TypeScript pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even after filtering values, TypeScript can still complain that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'u' is possibly undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logically the values are already filtered, but TypeScript narrowing does not always behave the way developers expect.&lt;/p&gt;

&lt;p&gt;So I started experimenting with AST-based transformations for these cases too.&lt;/p&gt;

&lt;p&gt;Now the CLI automatically converts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nb"&gt;NonNullable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which preserves narrowing correctly and removes the repeated &lt;code&gt;"possibly undefined"&lt;/code&gt; friction afterward.&lt;/p&gt;

&lt;p&gt;What’s been interesting while building this project is realizing how many TypeScript frustrations are not necessarily difficult problems, but repetitive workflow interruptions developers hit every day.&lt;/p&gt;

&lt;p&gt;Still very experimental, but AST transformations are turning out to be much more powerful than simple text replacements.&lt;/p&gt;

&lt;p&gt;Current fixes supported:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing function arguments (&lt;code&gt;TS2554&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Basic type mismatch fixes (&lt;code&gt;TS2322&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Undefined references (&lt;code&gt;TS2304&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.filter(Boolean)&lt;/code&gt; narrowing transformations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub:&lt;br&gt;
&lt;a href="https://github.com/i-am-killvish/fixmyfile" rel="noopener noreferrer"&gt;https://github.com/i-am-killvish/fixmyfile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;other repetitive TS friction points&lt;/li&gt;
&lt;li&gt;weird narrowing cases&lt;/li&gt;
&lt;li&gt;compiler issues developers repeatedly fight with&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>opensource</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I built a CLI that fixes TypeScript errors automatically</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Sat, 25 Apr 2026 01:20:24 +0000</pubDate>
      <link>https://forem.com/iamkillvish/i-built-a-cli-that-fixes-typescript-errors-automatically-8e3</link>
      <guid>https://forem.com/iamkillvish/i-built-a-cli-that-fixes-typescript-errors-automatically-8e3</guid>
      <description>&lt;p&gt;Fixing TypeScript errors like:&lt;/p&gt;

&lt;p&gt;“Expected 1 arguments, but got 0 (TS2554)”&lt;/p&gt;

&lt;p&gt;gets repetitive really fast.&lt;/p&gt;

&lt;p&gt;So I built a small CLI tool called fixmyfile that automatically fixes some common TypeScript errors using the compiler API and AST transformations.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ Demo
&lt;/h2&gt;

&lt;p&gt;Fixing a TypeScript error automatically:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vlll5uad82m62pq4tmt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vlll5uad82m62pq4tmt.gif" alt=" " width="720" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 What it does
&lt;/h2&gt;

&lt;p&gt;The tool:&lt;/p&gt;

&lt;p&gt;scans a .ts file&lt;br&gt;
detects TypeScript compiler errors&lt;br&gt;
applies automatic fixes&lt;br&gt;
repeats until no more changes are possible&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ Example
&lt;/h2&gt;

&lt;p&gt;❌ Before&lt;br&gt;
function greet(name: string) {&lt;br&gt;
  console.log(name);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;greet(); // missing args&lt;br&gt;
✅ After&lt;br&gt;
greet("text");&lt;/p&gt;

&lt;h2&gt;
  
  
  🖥 Try it
&lt;/h2&gt;

&lt;p&gt;You can run it directly using:&lt;/p&gt;

&lt;p&gt;npx fixmyfile yourfile.ts&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Currently supports
&lt;/h2&gt;

&lt;p&gt;Missing function arguments (TS2554)&lt;br&gt;
Basic type mismatch fixes (TS2322)&lt;br&gt;
Undefined references (TS2304)&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚠️ Note
&lt;/h2&gt;

&lt;p&gt;This is still experimental and focuses on common, repetitive fixes.&lt;br&gt;
Always review the output before committing changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  💬 Feedback
&lt;/h2&gt;

&lt;p&gt;Would love to know:&lt;/p&gt;

&lt;p&gt;Did it work on your code?&lt;br&gt;
What errors should it support next?&lt;br&gt;
Where did it break?&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/i-am-killvish/fixmyfile" rel="noopener noreferrer"&gt;https://github.com/i-am-killvish/fixmyfile&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Why I built this
&lt;/h2&gt;

&lt;p&gt;I kept running into the same TypeScript errors du&lt;a href="![%20](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0oxhmpvz70yltsh90uz.gif)"&gt;&lt;/a&gt;ring development and realized many of them are predictable enough to automate.&lt;/p&gt;

&lt;p&gt;This is an early attempt at making that process faster.&lt;/p&gt;

&lt;p&gt;If this sounds useful, give it a try and let me know what you think 🙂&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>productivity</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
