<?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>DEV Community: i-am-killvish</title>
    <description>The latest articles on DEV Community by i-am-killvish (@iamkillvish).</description>
    <link>https://dev.to/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>DEV Community: i-am-killvish</title>
      <link>https://dev.to/iamkillvish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamkillvish"/>
    <language>en</language>
    <item>
      <title>Regex vs AST: Why Compiler-Aware Code Transformations Are Safer</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Mon, 08 Jun 2026 14:05:42 +0000</pubDate>
      <link>https://dev.to/iamkillvish/regex-vs-ast-why-compiler-aware-code-transformations-are-safer-2i7</link>
      <guid>https://dev.to/iamkillvish/regex-vs-ast-why-compiler-aware-code-transformations-are-safer-2i7</guid>
      <description>&lt;h1&gt;
  
  
  Regex vs AST: Why Compiler-Aware Code Transformations Are Safer
&lt;/h1&gt;

&lt;p&gt;When developers want to automate code changes, the first instinct is often:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Find text
↓
Replace text
↓
Done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For simple cases, that works.&lt;/p&gt;

&lt;p&gt;For real codebases, it becomes dangerous surprisingly fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Regex Approach
&lt;/h2&gt;

&lt;p&gt;Suppose we want to modify every occurrence of:&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="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A regex solution might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/user.name/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user.fullName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple.&lt;/p&gt;

&lt;p&gt;Until you discover cases like:&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;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user.name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
// TODO: migrate user.name&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your regex doesn't understand code.&lt;/p&gt;

&lt;p&gt;It only understands text.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AST Approach
&lt;/h2&gt;

&lt;p&gt;An AST (Abstract Syntax Tree) understands structure.&lt;/p&gt;

&lt;p&gt;Instead of seeing:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
user.name&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;as characters, it sees:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
PropertyAccessExpression&lt;br&gt;
├── user&lt;br&gt;
└── name&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That distinction is powerful.&lt;/p&gt;

&lt;p&gt;Now a transformation can target only actual code constructs and ignore comments, strings, and unrelated text.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real Example
&lt;/h2&gt;

&lt;p&gt;While building a TypeScript auto-fixer, I recently worked on:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
TS2339: Property does not exist on type&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The fix wasn't:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
Insert text somewhere&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The fix was:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
Find interface&lt;br&gt;
↓&lt;br&gt;
Check existing properties&lt;br&gt;
↓&lt;br&gt;
Create AST node&lt;br&gt;
↓&lt;br&gt;
Update interface declaration&lt;br&gt;
↓&lt;br&gt;
Validate with compiler&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At that point, regex isn't really an option.&lt;/p&gt;

&lt;p&gt;The transformation needs structural understanding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AST Wins
&lt;/h2&gt;

&lt;p&gt;Regex:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
Fast&lt;br&gt;
Simple&lt;br&gt;
Fragile&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;AST:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;txt&lt;br&gt;
Structured&lt;br&gt;
Safe&lt;br&gt;
Compiler-aware&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The larger the codebase becomes, the more valuable that structural understanding gets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;The biggest lesson I've learned building developer tooling is that code isn't text.&lt;/p&gt;

&lt;p&gt;It's structure.&lt;/p&gt;

&lt;p&gt;And once you start thinking in terms of structure instead of strings, a lot of automation problems become much easier to solve safely.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>automation</category>
      <category>computerscience</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>From Compiler Error to Safe Fix: What I Learned Building a TypeScript Auto-Fixer</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Mon, 08 Jun 2026 10:13:39 +0000</pubDate>
      <link>https://dev.to/iamkillvish/from-compiler-error-to-safe-fix-what-i-learned-building-a-typescript-auto-fixer-48p9</link>
      <guid>https://dev.to/iamkillvish/from-compiler-error-to-safe-fix-what-i-learned-building-a-typescript-auto-fixer-48p9</guid>
      <description>&lt;h1&gt;
  
  
  Building a TypeScript Auto-Fixer Taught Me Something Unexpected
&lt;/h1&gt;

&lt;p&gt;When I started building a TypeScript auto-fixer, I assumed the problem was simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Compiler Error
↓
Edit Text
↓
Done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The more I worked on it, the more I realized I was completely wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Expected
&lt;/h2&gt;

&lt;p&gt;For example, consider this error:&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;subtitle&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;TypeScript reports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TS2339: Property 'subtitle' does not exist on type 'Props'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My first thought was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Find the line
↓
Insert some text
↓
Save the file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Easy, right?&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Discovered
&lt;/h2&gt;

&lt;p&gt;The real problem wasn't editing text.&lt;/p&gt;

&lt;p&gt;It was understanding code structure.&lt;/p&gt;

&lt;p&gt;Before making a change, I needed to know:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What property is missing?
↓
Which type owns it?
↓
Does it already exist?
↓
Where should it be inserted?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That led me into the TypeScript Compiler API and AST transformations.&lt;/p&gt;

&lt;p&gt;The implementation eventually looked more like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Compiler
↓
Diagnostics
↓
AST
↓
Transformation
↓
Validation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Trust Problem
&lt;/h2&gt;

&lt;p&gt;Suppose a tool discovers a missing property.&lt;/p&gt;

&lt;p&gt;Should it generate:&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both require assumptions.&lt;/p&gt;

&lt;p&gt;Instead, I chose:&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's safer and deterministic.&lt;/p&gt;

&lt;p&gt;The goal isn't to guess developer intent.&lt;/p&gt;

&lt;p&gt;The goal is to make safe, predictable changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;The biggest surprise wasn't learning the TypeScript Compiler API.&lt;/p&gt;

&lt;p&gt;It was realizing that code automation is much closer to compiler engineering than text processing.&lt;/p&gt;

&lt;p&gt;I thought I was building a tool that edits files.&lt;/p&gt;

&lt;p&gt;What I was actually building was a pipeline that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Understands
↓
Transforms
↓
Verifies
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that completely changed how I think about developer tooling.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>softwareengineering</category>
      <category>tooling</category>
      <category>typescript</category>
    </item>
    <item>
      <title>TS2339 Isn't Hard to Fix. It's Just Repetitive.</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Fri, 05 Jun 2026 17:24:16 +0000</pubDate>
      <link>https://dev.to/iamkillvish/ts2339-isnt-hard-to-fix-its-just-repetitive-38bc</link>
      <guid>https://dev.to/iamkillvish/ts2339-isnt-hard-to-fix-its-just-repetitive-38bc</guid>
      <description>&lt;h1&gt;
  
  
  One TypeScript Error That Creates More Workflow Friction Than It Should
&lt;/h1&gt;

&lt;p&gt;One TypeScript error I keep seeing across React and TypeScript projects looks like this:&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;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;subtitle&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;A few seconds later the compiler responds with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Property 'subtitle' does not exist on type 'Props'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance this seems completely reasonable.&lt;/p&gt;

&lt;p&gt;And honestly, it is.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Interesting Part
&lt;/h1&gt;

&lt;p&gt;The problem usually isn't understanding the fix.&lt;/p&gt;

&lt;p&gt;Most developers already know what needs to happen.&lt;/p&gt;

&lt;p&gt;Somewhere inside the type definition:&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;needs to be added.&lt;/p&gt;

&lt;p&gt;The compiler knows a property is missing.&lt;/p&gt;

&lt;p&gt;The developer knows a property is missing.&lt;/p&gt;

&lt;p&gt;The remaining work is usually just a mechanical edit.&lt;/p&gt;




&lt;h1&gt;
  
  
  But From The Developer Side...
&lt;/h1&gt;

&lt;p&gt;The actual friction isn't writing:&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The friction is everything around it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stop coding
↓
Find the type definition
↓
Add the property
↓
Return to the component
↓
Run TypeScript again
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Individually none of these steps feel expensive.&lt;/p&gt;

&lt;p&gt;Repeated dozens of times, they become workflow interruptions.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why It Happens So Often
&lt;/h1&gt;

&lt;p&gt;A component often starts here:&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;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;Then requirements change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add subtitle
↓
Add description
↓
Add icon
↓
Add badge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Implementation and types constantly drift out of sync.&lt;/p&gt;

&lt;p&gt;TS2339 is often the compiler catching that drift.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Real Friction
&lt;/h1&gt;

&lt;p&gt;The more I work with TypeScript, the more I notice that many frustrations aren't difficult problems.&lt;/p&gt;

&lt;p&gt;They're repetitive problems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Obvious
Mechanical
Predictable
Interruptive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Individually tiny.&lt;/p&gt;

&lt;p&gt;Repeated constantly.&lt;/p&gt;




&lt;h1&gt;
  
  
  Compiler Errors Are Often Already Solved
&lt;/h1&gt;

&lt;p&gt;What's interesting about TS2339 is that the compiler already provides most of the information needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Missing property
Target type
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In many cases the remaining work is simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structural synchronization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not debugging.&lt;/p&gt;

&lt;p&gt;Not architecture.&lt;/p&gt;

&lt;p&gt;Not reasoning.&lt;/p&gt;

&lt;p&gt;Just synchronization.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why This Became Interesting To Me
&lt;/h1&gt;

&lt;p&gt;While building my CLI project &lt;code&gt;fixmyfile&lt;/code&gt;, I started exploring these kinds of compiler-driven workflow interruptions.&lt;/p&gt;

&lt;p&gt;Instead of asking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How do I generate code?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I became more interested in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How do I eliminate repetitive developer actions?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The latest release adds TS2339 property synchronization.&lt;/p&gt;

&lt;p&gt;For example:&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;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;subtitle&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;can automatically become:&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;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;subtitle&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;using compiler diagnostics and AST transformations.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Workflow
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TypeScript Diagnostic
        ↓
AST Analysis
        ↓
Safe Structural Mutation
        ↓
Recompile
        ↓
Verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No AI.&lt;/p&gt;

&lt;p&gt;No semantic guessing.&lt;/p&gt;

&lt;p&gt;No invented types.&lt;/p&gt;

&lt;p&gt;If the compiler only knows a property is missing, FixMyFile adds:&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="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and verifies the result by recompiling.&lt;/p&gt;




&lt;h1&gt;
  
  
  What I Learned
&lt;/h1&gt;

&lt;p&gt;Developer productivity isn't always about solving harder problems.&lt;/p&gt;

&lt;p&gt;Sometimes it's about removing tiny interruptions that happen hundreds of times.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5 seconds
×
Hundreds of repetitions
=
Real workflow friction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I don't think TS2339 is a bad error.&lt;/p&gt;

&lt;p&gt;The compiler is doing exactly what it should.&lt;/p&gt;

&lt;p&gt;But I do think there's an opportunity for tooling that reduces repetitive structural fixes while preserving type safety.&lt;/p&gt;

&lt;p&gt;Because many developer frustrations don't come from complexity.&lt;/p&gt;

&lt;p&gt;They come from repetition.&lt;/p&gt;




&lt;p&gt;If you work heavily with TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Which compiler error do you find yourself fixing over and over again?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why React + TypeScript Nullability Slowly Becomes Exhausting</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Sat, 23 May 2026 14:47:44 +0000</pubDate>
      <link>https://dev.to/iamkillvish/why-react-typescript-nullability-slowly-becomes-exhausting-473g</link>
      <guid>https://dev.to/iamkillvish/why-react-typescript-nullability-slowly-becomes-exhausting-473g</guid>
      <description>&lt;h1&gt;
  
  
  One React + TypeScript Pattern That Slowly Turns Into Workflow Fatigue
&lt;/h1&gt;

&lt;p&gt;One React + TypeScript pattern I keep seeing everywhere looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few minutes later, the component becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;avatar&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repeated across the entire component tree.&lt;/p&gt;

&lt;p&gt;Individually, none of these lines feel like a huge problem.&lt;/p&gt;

&lt;p&gt;But repeated hundreds of times across a codebase,&lt;br&gt;
they slowly become surprisingly exhausting.&lt;/p&gt;


&lt;h1&gt;
  
  
  The Interesting Part
&lt;/h1&gt;

&lt;p&gt;The frustrating thing is:&lt;/p&gt;

&lt;p&gt;TypeScript is not wrong here.&lt;/p&gt;

&lt;p&gt;React state often starts as &lt;code&gt;null&lt;/code&gt; because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;data is loading&lt;/li&gt;
&lt;li&gt;async requests haven't completed&lt;/li&gt;
&lt;li&gt;auth state is unresolved&lt;/li&gt;
&lt;li&gt;server data hasn't arrived yet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the compiler is being intentionally conservative.&lt;/p&gt;

&lt;p&gt;And honestly, that safety is useful.&lt;/p&gt;


&lt;h1&gt;
  
  
  But From The Developer Side...
&lt;/h1&gt;

&lt;p&gt;After a while, it can start feeling like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;avatar&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;preferences&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;over and over again.&lt;/p&gt;

&lt;p&gt;Especially in larger React applications where nullable async state exists almost everywhere.&lt;/p&gt;




&lt;h1&gt;
  
  
  Async Fetching Makes It Worse
&lt;/h1&gt;

&lt;p&gt;A very common pattern looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;fetchUser&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;);&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;From TypeScript’s perspective:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user might still be null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which is technically correct.&lt;/p&gt;

&lt;p&gt;But mentally, developers often already understand the lifecycle flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;loading → data arrives → component renders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That creates an interesting tension between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;compiler safety&lt;/li&gt;
&lt;li&gt;runtime understanding&lt;/li&gt;
&lt;li&gt;developer ergonomics&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  The Real Friction
&lt;/h1&gt;

&lt;p&gt;I’ve started noticing that many TypeScript frustrations are not huge architectural problems.&lt;/p&gt;

&lt;p&gt;They’re usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;repetitive&lt;/li&gt;
&lt;li&gt;mechanical&lt;/li&gt;
&lt;li&gt;mentally interruptive&lt;/li&gt;
&lt;li&gt;individually tiny&lt;/li&gt;
&lt;li&gt;but exhausting when repeated constantly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;don’t feel huge in isolation.&lt;/p&gt;

&lt;p&gt;But repeated across hundreds of components,&lt;br&gt;
they slowly create workflow fatigue.&lt;/p&gt;


&lt;h1&gt;
  
  
  React + TypeScript Has A Unique Kind Of Friction
&lt;/h1&gt;

&lt;p&gt;What makes React especially interesting is that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;async UI state naturally creates nullability everywhere
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike many backend systems where data may already be validated before use,&lt;br&gt;
React components constantly deal with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;loading states&lt;/li&gt;
&lt;li&gt;delayed async data&lt;/li&gt;
&lt;li&gt;partial renders&lt;/li&gt;
&lt;li&gt;optional props&lt;/li&gt;
&lt;li&gt;unresolved context values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;which makes defensive rendering patterns extremely common.&lt;/p&gt;


&lt;h1&gt;
  
  
  Why This Became Interesting To Me
&lt;/h1&gt;

&lt;p&gt;Recently I’ve been exploring these React + TypeScript friction patterns more deeply while working on compiler-aware tooling and AST-based fixes in my CLI project &lt;code&gt;fixmyfile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And honestly, the deeper I go into TypeScript ecosystems,&lt;br&gt;
the more I feel developer frustration often comes from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;small repetitive safety patterns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;not massive technical failures.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I don’t think TypeScript is wrong here.&lt;/p&gt;

&lt;p&gt;The compiler is intentionally conservative.&lt;/p&gt;

&lt;p&gt;But I do think there’s a growing opportunity for tooling and developer workflows that reduce:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;repetitive defensive rendering&lt;/li&gt;
&lt;li&gt;cognitive interruptions&lt;/li&gt;
&lt;li&gt;mechanical nullability friction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;without sacrificing type safety.&lt;/p&gt;

&lt;p&gt;And honestly, React + strict TypeScript has become one of the most interesting ecosystems to study from a developer ergonomics perspective.&lt;/p&gt;




&lt;p&gt;If you work heavily with React + TypeScript, I’d genuinely be curious:&lt;/p&gt;

&lt;p&gt;what repetitive friction pattern annoys you the most?&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Why Autofixing Missing TypeScript Arguments Is Harder Than It Looks</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Mon, 18 May 2026 11:17:28 +0000</pubDate>
      <link>https://dev.to/iamkillvish/why-autofixing-missing-typescript-arguments-is-harder-than-it-looks-1dlj</link>
      <guid>https://dev.to/iamkillvish/why-autofixing-missing-typescript-arguments-is-harder-than-it-looks-1dlj</guid>
      <description>&lt;h1&gt;
  
  
  Why Autofixing Missing TypeScript Arguments Is Harder Than It Looks
&lt;/h1&gt;

&lt;p&gt;One TypeScript error that looked deceptively simple to autofix at first was this:&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript immediately complains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Expected 2 arguments, but got 1.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance, the fix feels obvious.&lt;/p&gt;

&lt;p&gt;Why not just automatically transform this 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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or maybe:&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;depending on the parameter type?&lt;/p&gt;

&lt;p&gt;The compiler error disappears instantly.&lt;/p&gt;

&lt;p&gt;Problem solved… right?&lt;/p&gt;




&lt;h1&gt;
  
  
  The Dangerous Part
&lt;/h1&gt;

&lt;p&gt;The more I thought about it though, the more uncomfortable that approach started feeling.&lt;/p&gt;

&lt;p&gt;Because now the compiler is happy.&lt;/p&gt;

&lt;p&gt;But the runtime behavior may already be wrong.&lt;/p&gt;

&lt;p&gt;That &lt;code&gt;0&lt;/code&gt; might silently affect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pricing logic&lt;/li&gt;
&lt;li&gt;discounts&lt;/li&gt;
&lt;li&gt;analytics&lt;/li&gt;
&lt;li&gt;permissions&lt;/li&gt;
&lt;li&gt;feature flags&lt;/li&gt;
&lt;li&gt;business calculations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code compiles.&lt;/p&gt;

&lt;p&gt;But the original intent may already be broken.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Small Example
&lt;/h1&gt;

&lt;p&gt;Imagine something like this:&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="nf"&gt;applyDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;percentage&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now suppose the developer accidentally forgets the second argument:&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="nf"&gt;applyDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A naive autofix might generate:&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="nf"&gt;applyDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript becomes happy.&lt;/p&gt;

&lt;p&gt;But now the business logic silently changes.&lt;/p&gt;

&lt;p&gt;That missing argument may not have meant:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0% discount
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It may have meant:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"the developer forgot something important"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That was a pretty important realization for me.&lt;/p&gt;




&lt;h1&gt;
  
  
  Compiler Correct ≠ Runtime Correct
&lt;/h1&gt;

&lt;p&gt;One thing I’ve started realizing while building TypeScript tooling is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;making the compiler happy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;preserving runtime intent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;are very different problems.&lt;/p&gt;

&lt;p&gt;A fix can be technically valid from the compiler’s perspective while still being dangerous for the actual application logic.&lt;/p&gt;

&lt;p&gt;That’s where autofixing becomes surprisingly tricky.&lt;/p&gt;

&lt;p&gt;Because the more aggressively a tool tries to “repair” code automatically,&lt;br&gt;
the easier it becomes to silently change behavior developers actually cared about.&lt;/p&gt;


&lt;h1&gt;
  
  
  Why This Felt Wrong
&lt;/h1&gt;

&lt;p&gt;Initially, I tried generating values automatically based on the parameter type.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;number  -&amp;gt; 0
string  -&amp;gt; ""
boolean -&amp;gt; true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the compiler’s perspective:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;perfect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From a runtime/business perspective:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;potentially dangerous
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because now the tool was effectively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;inventing developer intent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that felt wrong.&lt;/p&gt;

&lt;p&gt;A developer may have forgotten:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a discount percentage&lt;/li&gt;
&lt;li&gt;a tax value&lt;/li&gt;
&lt;li&gt;a feature flag&lt;/li&gt;
&lt;li&gt;a permission value&lt;/li&gt;
&lt;li&gt;a calculation input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Automatically generating fake business values could hide real logic mistakes instead of helping reveal them.&lt;/p&gt;




&lt;h1&gt;
  
  
  Rethinking The Repair Strategy
&lt;/h1&gt;

&lt;p&gt;That realization eventually made me redesign the TS2554 repair logic inside my CLI tool &lt;code&gt;fixmyfile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of inventing business values automatically,&lt;br&gt;
the tool now prefers minimal compiler-safe placeholders like:&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="kc"&gt;undefined&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So this:&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;becomes:&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important difference is that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the compiler error disappears&lt;/li&gt;
&lt;li&gt;the missing value stays visible&lt;/li&gt;
&lt;li&gt;runtime intent is not silently fabricated&lt;/li&gt;
&lt;li&gt;developers can intentionally revisit the logic later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That felt like a much safer tradeoff.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Interesting Part Wasn't The AST Transform
&lt;/h1&gt;

&lt;p&gt;Ironically, generating the AST transformation itself was not even the hardest part.&lt;/p&gt;

&lt;p&gt;The harder part was making the fix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;predictable&lt;/li&gt;
&lt;li&gt;minimal&lt;/li&gt;
&lt;li&gt;non-destructive&lt;/li&gt;
&lt;li&gt;repeatable&lt;/li&gt;
&lt;li&gt;compiler-aware&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;because AST transforms can become destructive very quickly if existing arguments are not preserved carefully.&lt;/p&gt;

&lt;p&gt;Early versions of the fixer accidentally replaced valid existing arguments entirely.&lt;/p&gt;

&lt;p&gt;That was the moment I started realizing how much developer tooling is really about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;preserving developer trust
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;instead of simply replacing syntax.&lt;/p&gt;




&lt;h1&gt;
  
  
  Small TypeScript Friction Adds Up
&lt;/h1&gt;

&lt;p&gt;One thing I keep noticing in TypeScript ecosystems is that many frustrations are not huge architectural problems.&lt;/p&gt;

&lt;p&gt;They’re usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;repetitive&lt;/li&gt;
&lt;li&gt;mechanical&lt;/li&gt;
&lt;li&gt;mentally draining&lt;/li&gt;
&lt;li&gt;individually tiny&lt;/li&gt;
&lt;li&gt;but exhausting when repeated constantly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things like:&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="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;all look small individually.&lt;/p&gt;

&lt;p&gt;But repeated hundreds of times,&lt;br&gt;
they slowly create workflow friction.&lt;/p&gt;


&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I don’t think TypeScript is wrong here.&lt;/p&gt;

&lt;p&gt;The compiler is intentionally conservative.&lt;/p&gt;

&lt;p&gt;But I do think there’s a growing opportunity for tooling that helps bridge the gap between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what developers obviously mean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what the compiler can safely infer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s the direction I’ve been exploring recently with compiler-aware AST fixes and TypeScript tooling.&lt;/p&gt;

&lt;p&gt;And honestly, it has become one of the most interesting parts of working with the TypeScript ecosystem so far.&lt;/p&gt;




&lt;p&gt;If you’ve run into similar TypeScript friction patterns repeatedly, I’d genuinely love to hear which ones annoy you the most.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why `.filter(Boolean)` Doesn't Narrow Types in TypeScript (and how I built an AST fixer for it)</title>
      <dc:creator>i-am-killvish</dc:creator>
      <pubDate>Thu, 14 May 2026 01:09:00 +0000</pubDate>
      <link>https://dev.to/iamkillvish/why-filterboolean-doesnt-narrow-types-in-typescriptand-how-i-built-an-ast-fixer-for-it-3ijh</link>
      <guid>https://dev.to/iamkillvish/why-filterboolean-doesnt-narrow-types-in-typescriptand-how-i-built-an-ast-fixer-for-it-3ijh</guid>
      <description>&lt;p&gt;One TypeScript behavior that confused me for a long time was this:&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;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&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;values&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;v&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;v&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At runtime, this works perfectly.&lt;/p&gt;

&lt;p&gt;But TypeScript may still complain:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;At first glance, this feels wrong.&lt;/p&gt;

&lt;p&gt;We already filtered the array.&lt;br&gt;
Why is TypeScript still acting like &lt;code&gt;undefined&lt;/code&gt; can exist?&lt;/p&gt;


&lt;h1&gt;
  
  
  The Important Thing to Understand
&lt;/h1&gt;

&lt;p&gt;TypeScript does not deeply analyze what &lt;code&gt;Boolean()&lt;/code&gt; actually does.&lt;/p&gt;

&lt;p&gt;Instead, TypeScript mostly relies on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;control-flow analysis&lt;/li&gt;
&lt;li&gt;recognized syntax patterns&lt;/li&gt;
&lt;li&gt;explicit type predicates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So when you write:&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="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;TypeScript mainly sees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"A function returning boolean"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"This removes undefined and null values from the array"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That relationship gets lost.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why &lt;code&gt;!!value&lt;/code&gt; Feels Different
&lt;/h1&gt;

&lt;p&gt;This is similar to another TypeScript behavior:&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;isValid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;usually narrows correctly, while:&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;isValid&lt;/span&gt; &lt;span class="o"&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;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;often does not.&lt;/p&gt;

&lt;p&gt;Even though both behave similarly at runtime.&lt;/p&gt;

&lt;p&gt;The reason is that TypeScript recognizes:&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="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;as a direct truthiness check pattern.&lt;/p&gt;

&lt;p&gt;But:&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="nc"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;looks like a normal function call from the compiler’s perspective.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Correct TypeScript-Friendly Fix
&lt;/h1&gt;

&lt;p&gt;Instead of:&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;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&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;use an explicit type predicate:&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;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&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;Now TypeScript understands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“If this function returns true,
this value is not null or undefined.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So this works safely:&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="nx"&gt;values&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;v&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;v&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;without narrowing issues.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem
&lt;/h1&gt;

&lt;p&gt;This fix is technically correct.&lt;/p&gt;

&lt;p&gt;But after seeing this pattern repeatedly across projects, I realized something:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this is mostly mechanical work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A developer already knows what they meant.&lt;/p&gt;

&lt;p&gt;The compiler just needs help understanding it.&lt;/p&gt;

&lt;p&gt;And that made me wonder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Could this be fixed automatically?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Building an AST Fixer for It
&lt;/h1&gt;

&lt;p&gt;I’ve been building a small TypeScript CLI tool called &lt;code&gt;fixmyfile&lt;/code&gt; that automatically repairs repetitive TypeScript friction using compiler diagnostics and AST transformations.&lt;/p&gt;

&lt;p&gt;One of the fixes now detects:&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="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;and transforms it 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="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="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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;automatically.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Interesting Part
&lt;/h1&gt;

&lt;p&gt;The transformation itself was not the hardest part.&lt;/p&gt;

&lt;p&gt;The harder part was making the fix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;predictable&lt;/li&gt;
&lt;li&gt;safe&lt;/li&gt;
&lt;li&gt;repeatable&lt;/li&gt;
&lt;li&gt;compiler-aware&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;because TypeScript diagnostics and AST nodes do not always align exactly the way you initially expect.&lt;/p&gt;

&lt;p&gt;That was the moment I started realizing how much developer tooling is really about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;understanding compiler behavior deeply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;instead of simply replacing strings.&lt;/p&gt;




&lt;h1&gt;
  
  
  One Thing I’ve Learned Building This
&lt;/h1&gt;

&lt;p&gt;A surprising amount of TypeScript frustration comes from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;small repetitive mechanical fixes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;not huge architectural problems.&lt;/p&gt;

&lt;p&gt;Things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;optional chaining insertion&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.filter(Boolean)&lt;/code&gt; narrowing&lt;/li&gt;
&lt;li&gt;missing arguments&lt;/li&gt;
&lt;li&gt;repetitive null checks&lt;/li&gt;
&lt;li&gt;strict-mode cleanup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;individually feel tiny.&lt;/p&gt;

&lt;p&gt;But repeated hundreds of times, they slowly create workflow friction.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I don’t think TypeScript is wrong here.&lt;/p&gt;

&lt;p&gt;The compiler is being conservative intentionally.&lt;/p&gt;

&lt;p&gt;But I do think there’s a growing opportunity for tooling that helps bridge the gap between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what developers obviously mean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what the compiler can safely infer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s the direction I’ve been exploring recently with AST-based fixes and compiler-driven transformations.&lt;/p&gt;

&lt;p&gt;And honestly, it has been one of the most interesting parts of working with TypeScript so far.&lt;/p&gt;




&lt;p&gt;If you’ve run into similar TypeScript friction patterns repeatedly, I’d genuinely love to hear which ones annoy you the most.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
    <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://dev.to/iamkillvish/extending-my-typescript-auto-fix-cli-to-handle-filterboolean-narrowing-issues-21cd</link>
      <guid>https://dev.to/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://dev.to/iamkillvish/i-built-a-cli-that-fixes-typescript-errors-automatically-8e3</link>
      <guid>https://dev.to/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>
