<?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: Muhammad Mozzammel Haque</title>
    <description>The latest articles on DEV Community by Muhammad Mozzammel Haque (@mozzammel_haque).</description>
    <link>https://dev.to/mozzammel_haque</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4124826%2Faed41d4a-9d1a-45b8-ba4d-780c9a1ffb54.jpg</url>
      <title>DEV Community: Muhammad Mozzammel Haque</title>
      <link>https://dev.to/mozzammel_haque</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mozzammel_haque"/>
    <language>en</language>
    <item>
      <title>Metro doesn't type-check your React Native app, so I made Gradle do it</title>
      <dc:creator>Muhammad Mozzammel Haque</dc:creator>
      <pubDate>Tue, 27 Oct 2026 08:05:04 +0000</pubDate>
      <link>https://dev.to/mozzammel_haque/metro-doesnt-type-check-your-react-native-app-so-i-made-gradle-do-it-57n5</link>
      <guid>https://dev.to/mozzammel_haque/metro-doesnt-type-check-your-react-native-app-so-i-made-gradle-do-it-57n5</guid>
      <description>&lt;p&gt;React Native never type-checks your TypeScript when it builds. Metro hands every file to Babel, Babel deletes the type annotations, and the bundle ships. A function that expects a number and gets a string bundles without a single warning. You find out at runtime, usually on a screen you didn't open while testing.&lt;/p&gt;

&lt;p&gt;The editor underlines the error in red, so it's easy to assume the build checks it too. It doesn't. Only &lt;code&gt;tsc&lt;/code&gt; does, and nothing runs &lt;code&gt;tsc&lt;/code&gt; unless you tell it to.&lt;/p&gt;

&lt;p&gt;I made type errors fail the build. It takes two pieces.&lt;/p&gt;

&lt;h2&gt;
  
  
  The npm script
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"typecheck"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tsc --noEmit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm run typecheck &amp;amp;&amp;amp; react-native run-android"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--noEmit&lt;/code&gt; is the important flag. Metro already produces the JavaScript, so &lt;code&gt;tsc&lt;/code&gt; only has to check.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Gradle hook
&lt;/h2&gt;

&lt;p&gt;The script covers anyone who starts the app with &lt;code&gt;npm run android&lt;/code&gt;. It does nothing when someone presses Run in Android Studio, or when CI calls &lt;code&gt;./gradlew assembleRelease&lt;/code&gt; directly. So I hooked the same check into Gradle, in &lt;code&gt;android/app/build.gradle&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;isWindows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getProperty&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'os.name'&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'windows'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;tasks&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'typecheck'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Exec&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;workingDir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rootProject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;projectDir&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;parentFile&lt;/span&gt;
    &lt;span class="n"&gt;commandLine&lt;/span&gt; &lt;span class="n"&gt;isWindows&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cmd'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/c'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'npx'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'tsc'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'--noEmit'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'npx'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'tsc'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'--noEmit'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;preBuild&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependsOn&lt;/span&gt; &lt;span class="s1"&gt;'typecheck'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Windows branch exists because Gradle's &lt;code&gt;Exec&lt;/code&gt; can't launch &lt;code&gt;npx&lt;/code&gt; directly there. On Windows &lt;code&gt;npx&lt;/code&gt; is a &lt;code&gt;.cmd&lt;/code&gt; shim, so it has to go through &lt;code&gt;cmd /c&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When &lt;code&gt;tsc&lt;/code&gt; finds an error it exits non-zero, the &lt;code&gt;Exec&lt;/code&gt; task fails, and Gradle stops before it compiles anything.&lt;/p&gt;

&lt;p&gt;This puts a full type-check in front of every Android build, so on a large codebase you'll feel it. If that gets annoying during development, keep the npm script for local runs and attach the Gradle task only to release builds.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>typescript</category>
      <category>android</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Calling Rust from Node with napi-rs: 6x faster for heavy work, 19x slower for tiny calls</title>
      <dc:creator>Muhammad Mozzammel Haque</dc:creator>
      <pubDate>Mon, 12 Oct 2026 15:27:42 +0000</pubDate>
      <link>https://dev.to/mozzammel_haque/calling-rust-from-node-with-napi-rs-6x-faster-for-heavy-work-19x-slower-for-tiny-calls-3ej9</link>
      <guid>https://dev.to/mozzammel_haque/calling-rust-from-node-with-napi-rs-6x-faster-for-heavy-work-19x-slower-for-tiny-calls-3ej9</guid>
      <description>&lt;p&gt;I called a Rust function from Node 5 million times. It was 19x slower than the same function in plain JavaScript.&lt;/p&gt;

&lt;p&gt;The function just adds two numbers. About 106 ns per native call against 5.5 ns in JS, because V8 inlines the JS version and the native one has to cross the boundary every time.&lt;br&gt;
Then I gave Rust real work. Recursive fib(38) went from 726 ms to 116 ms, about 6x faster. A prime sieve over 20M numbers was only 1.5x faster.&lt;/p&gt;

&lt;p&gt;The part that surprised me most: passing a plain JS array of 1M numbers into Rust took 85 ms. A Float64Array took 1.3 ms, same as a JS loop.&lt;/p&gt;

&lt;p&gt;On my 2 vCPU box, native code started to pay off once the JS version of a call took around a microsecond. I did not test WASM because I couldn't install the target in my sandbox.&lt;/p&gt;

&lt;p&gt;Full numbers, code and raw output are in the article:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/gitconnected/calling-rust-from-node-with-napi-rs-6x-faster-for-heavy-work-19x-slower-for-tiny-calls-fe0f8828924b?sharedUserId=mozzammeluiu" rel="noopener noreferrer"&gt;https://medium.com/gitconnected/calling-rust-from-node-with-napi-rs-6x-faster-for-heavy-work-19x-slower-for-tiny-calls-fe0f8828924b?sharedUserId=mozzammeluiu&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>javascript</category>
      <category>backenddevelopment</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
