<?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 Ashish Kumar Meena on Medium]]></title>
        <description><![CDATA[Stories by Ashish Kumar Meena on Medium]]></description>
        <link>https://medium.com/@dewandameena1098?source=rss-c5fc5ed66c85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Ashish Kumar Meena on Medium</title>
            <link>https://medium.com/@dewandameena1098?source=rss-c5fc5ed66c85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:19:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dewandameena1098/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[Type Narrowing in TypeScript: A Simple Guide]]></title>
            <link>https://medium.com/@dewandameena1098/type-narrowing-in-typescript-a-simple-guide-1e5bcb6a1319?source=rss-c5fc5ed66c85------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e5bcb6a1319</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ashish Kumar Meena]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 10:49:21 GMT</pubDate>
            <atom:updated>2025-12-19T10:49:21.659Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of JavaScript, variables are often like a “mystery box” — you never know exactly what’s inside until your app crashes. TypeScript solves this with Type Narrowing.</p><p>Type Narrowing is the process of taking a broad type (like string | number) and using “checks” to prove to TypeScript exactly what type it is at a specific moment.</p><h4>1. typeof Guard (Primitive Check)</h4><p><strong>Use Case:</strong> When a variable can be a simple type like a string or a number.</p><p><strong>Example:</strong> An order &quot;kind&quot; can be a name (string) or an ID (number).</p><pre>function getChai(kind: string | number) {<br>    if (typeof kind === &quot;string&quot;) {<br>        // Guaranteed to be a string here<br>        return `Making your ${kind} chai...`;<br>    } else {<br>        // Guaranteed to be a number here<br>        return `Order number ${kind} is being prepared.`;<br>    }<br>}</pre><h4>2. Truthiness Guard (Existence Check)</h4><p><strong>Use Case:</strong> When a value might be missing (optional).</p><p><strong>Example:</strong> A customer might or might not leave a special instruction message.</p><pre>function serveChai(message?: string) {<br>    if (message) {<br>        // Guaranteed that the message exists and is not empty<br>        return `Serving with note: ${message}`;<br>    }<br>    return &quot;Serving default Masala Chai.&quot;;<br>}</pre><h4>3. instanceof Guard (Class Check)</h4><p><strong>Use Case:</strong> When you have different classes that might share the same method names.</p><p><strong>Example:</strong> Different ways of serving chai, like a <strong>Kulhad</strong> (clay cup) vs. <strong>Cutting</strong> (small glass).</p><pre>class KulhadChai { serve() { return &quot;Serving in clay cup&quot;; } }<br>class CuttingChai { serve() { return &quot;Serving in small glass&quot;; } }<br><br>function deliverChai(chai: KulhadChai | CuttingChai) {<br>    if (chai instanceof KulhadChai) {<br>        // Confirmed this is specifically a KulhadChai<br>        return chai.serve();<br>    }<br>    return chai.serve();<br>}</pre><h4>4. Custom Type Guards (is Keyword)</h4><p><strong>Use Case:</strong> When checking complex objects from an API or external source.</p><p><strong>Example:</strong> Verifying if an object is a valid ChaiOrder.</p><pre>type ChaiOrder = { type: string; sugar: number };<br><br>function isChaiOrder(obj: any): obj is ChaiOrder {<br>    // We check every property to ensure it follows the contract<br>    return (<br>        typeof obj === &quot;object&quot; &amp;&amp;<br>        obj !== null &amp;&amp;<br>        &quot;type&quot; in obj &amp;&amp;<br>        &quot;sugar&quot; in obj<br>    );<br>}</pre><h4>5. The in Operator (Property Check)</h4><p><strong>Use Case:</strong> To check if a specific property exists inside an object to identify its type.</p><p><strong>Example:</strong> Only <strong>Masala Chai</strong> has a spiceLevel.</p><pre>type MasalaChai = { type: &quot;masala&quot;; spiceLevel: number };<br>type GingerChai = { type: &quot;ginger&quot; };<br><br>function brew(order: MasalaChai | GingerChai) {<br>    if (&quot;spiceLevel&quot; in order) {<br>        // Only MasalaChai has this property<br>        return `Brewing with spice level ${order.spiceLevel}`;<br>    }<br>    return &quot;Brewing Ginger Chai.&quot;;<br>}</pre><h4>6. Discriminated Unions (The “Type” Property)</h4><p><strong>Use Case:</strong> The <strong>most recommended</strong> way for production. You add a common “tag” or “type” property to every object.</p><p><strong>Example:</strong> Using a switch case to handle different tea flavors.</p><pre>type Tea = <br>      { kind: &quot;masala&quot;; spice: number }<br>    | { kind: &quot;ginger&quot;; aroma: string }<br>    | { kind: &quot;elaichi&quot;; amount: number };<br><br>function makeTea(order: Tea) {<br>    switch (order.kind) {<br>        case &quot;masala&quot;:<br>            return `Making Masala with ${order.spice} spice.`;<br>        case &quot;ginger&quot;:<br>            // IDE gives perfect autocomplete for &#39;aroma&#39; here<br>            return `Making Ginger with ${order.aroma} aroma.`;<br>        case &quot;elaichi&quot;:<br>            return `Making Elaichi with ${order.amount} amount.`;<br>    }<br>}</pre><p><strong><em>Why Should You Care?</em></strong><br>1. Safety: Your app won’t crash by calling a “string method” on a “number.”</p><p>2. Autocomplete: Once narrowed, your IDE (VS Code) will suggest the correct properties.</p><p>3. Cleaner Code: You don’t need to use the any keyword, which keeps your codebase healthy.</p><p>that’s it for today. see you in next one.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e5bcb6a1319" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typescript — Understanding Union and Any]]></title>
            <link>https://medium.com/@dewandameena1098/typescript-understanding-union-and-any-d15cd819c2be?source=rss-c5fc5ed66c85------2</link>
            <guid isPermaLink="false">https://medium.com/p/d15cd819c2be</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[blog]]></category>
            <dc:creator><![CDATA[Ashish Kumar Meena]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 08:56:26 GMT</pubDate>
            <atom:updated>2025-12-19T08:59:27.751Z</atom:updated>
            <content:encoded><![CDATA[<h3>Typescript — Understanding Union and Any</h3><h3>A. What is Union:</h3><p>By union you can tell typescript 2 things what types this variable can have (can be more than one) and also what values this variable can have can have.</p><pre>let id: string | number; // id can either be string or number only <br>let airlineseat: &#39;window&#39; | &#39;aisle&#39; | &#39;middle&#39; = &#39;middle&#39; // airlineseat can only be window, aisle or middle and nothing else</pre><p><em>When to use it:</em></p><ol><li>When a function can return different things (e.g., a User object OR null).</li><li>When a variable has a limited set of allowed values (e.g., status: &quot;success&quot; | &quot;error&quot; | &quot;loading&quot;).</li></ol><h4><strong>B. What is <em>any:</em></strong></h4><p>It literally tells typescript <em>stop checking my code, I don’t want your help here. </em>It turns off all the type safety of typescript.</p><p><em>When to use it:</em></p><ol><li><strong>Migrating:</strong> When you are moving a huge old JavaScript project to TypeScript and don’t have time to fix everything yet.</li></ol><p><strong>2. Third-party bugs:</strong> When a library you are using has a bug in its types and you just need the code to run.</p><p><strong><em>Warning:</em></strong> Try to avoid any as much as you can as writing code with any is just writing javascript code with extra steps.</p><h3>C. any vs. unknown (The Difference)</h3><p>Both mean “this could be anything,” but they act very differently when you try to use them.</p><h4>any (The &quot;Trust Me&quot; type)</h4><p>If you label something any, TypeScript lets you do <strong>anything</strong> with it, even if it makes no sense.</p><ul><li><strong>Analogy:</strong> A “Magic Bag.” You can reach in and try to “drive” it like a car, even if there’s a sandwich inside. TypeScript won’t stop you, but your app might crash.t</li></ul><pre>let value: any = &quot;Hello&quot;;<br>value.toUpperCase(); // Works<br>value.push(5);       // TypeScript says &quot;Fine!&quot;, but the code crashes (strings don&#39;t have .push)</pre><h4>unknown (The &quot;Safety First&quot; type)</h4><p>If you label something unknown, TypeScript says: <em>&quot;I don&#39;t know what this is, so I won&#39;t let you touch it until you prove what it is.&quot;</em></p><ul><li><strong>Analogy:</strong> A “Locked Box.” You can’t use what’s inside until you open it and check if it’s the right tool.</li></ul><pre>let value: unknown = &quot;Hello&quot;;<br><br>// value.toUpperCase(); // Error! TypeScript says: &quot;Wait, I don&#39;t know if this is a string.&quot;<br><br>if (typeof value === &quot;string&quot;) {<br>    value.toUpperCase(); // Now it works! You &quot;proved&quot; it&#39;s a string.</pre><p>That’s pretty much about union and any. see you in the next one.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d15cd819c2be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typescript Behind the scenes]]></title>
            <link>https://medium.com/@dewandameena1098/typescript-behind-the-scenes-a206ec11ed87?source=rss-c5fc5ed66c85------2</link>
            <guid isPermaLink="false">https://medium.com/p/a206ec11ed87</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[node]]></category>
            <dc:creator><![CDATA[Ashish Kumar Meena]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 12:42:52 GMT</pubDate>
            <atom:updated>2025-12-17T12:42:52.893Z</atom:updated>
            <content:encoded><![CDATA[<p>As we know already typescript is javascript only with added functionality of type checking in development environment. so now it becomes essential for us to know it’s behind the scenes. and that’s what we are going to discuss today.</p><h4>Flow components from .ts to .js :</h4><p>following are the main components participating in code converting from typescript to javascript and other formats</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuAioSwPv1p-xsf03NslJA.png" /><figcaption>Fig. Flow from TS code to JS code</figcaption></figure><p>let’s discuss them one by one in brief:</p><ol><li><strong>Lexer (lexical Analyzer):</strong></li></ol><p>It reads our code character by character and groups them into words called tokens. it will do basic syntax checking of the code like missing of semicolon etc.</p><p><strong>2. Parser (Syntax Analyzer):</strong></p><p>it then takes those words or tokens and create a AST (Abstract syntax tree) and see if they making a valid sentence or not.</p><p><strong>3. Binder:</strong></p><p>After Parser code goes to Binder. It then makes specialized symbol tables for typescript code. It also keep track of it’s parent pointers inside tree. and also it handles the flow nodes.</p><p><strong>4. Checker:</strong></p><p>It takes most of the time because it traverse the whole code bases that we were consistent regarding types across codebase. it uses some optimization techniques like short circuit etc. basically here only it does strict checking of the syntax. Many modern code editors like vs code add this part independently in their codebase to give type erros in typescript code.</p><p><strong>5. Emitter:</strong></p><p>It’s main job is to generate the .js, .d.ts, .map files and to strip off the additional code of typescript syntax.</p><p>and thus we finally get the .js file from a .ts file.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a206ec11ed87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Typescript]]></title>
            <link>https://medium.com/@dewandameena1098/what-is-typescript-caf27f00cb1a?source=rss-c5fc5ed66c85------2</link>
            <guid isPermaLink="false">https://medium.com/p/caf27f00cb1a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ashish Kumar Meena]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 12:06:37 GMT</pubDate>
            <atom:updated>2025-12-17T12:06:37.293Z</atom:updated>
            <content:encoded><![CDATA[<p>Typescript is just javascript with superpowers of type checking. It gives us erros or warning regarding type mismatch while we are writing code in developement which helps us to identify type related bugs in development only. also, it helps us to write a more scalable, type bug free and Maintainable code from the day one.</p><p>Now we know typescript is just javascript with superpowers. we can easily illustrate the flow from <strong>ts</strong> to <strong>js</strong> by the following diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*51kOhnG9sEJ5kDLDtoVrOA.png" /><figcaption>Fig. Flow from .ts to .js</figcaption></figure><p>An example comparision of typescript and javascript code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*8hUY-qHjdo4nyfUDLhdlYw.png" /><figcaption>Fig. Typescript code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*r0K5y-fJ4B66NVLHqPSOfw.png" /><figcaption>Fig. Javascript code</figcaption></figure><p>For hands on browser experience u can visit <a href="https://www.typescriptlang.org/play/#code/PTAEHUFMBsGMHsC2lQBd5oBYoCoE8AHSAZVgCcBLA1UABWgEM8BzM+AVwDsATAGiwoBnUENANQAd0gAjQRVSQAUCEmYKsTKGYUAbpGF4OY0BoadYKdJMoL+gzAzIoz3UNEiPOofEVKVqAHSKymAAmkYI7NCuqGqcANag8ABmIjQUXrFOKBJMggBcISGgoAC0oACCbvCwDKgU8JkY7p7ehCTkVDQS2E6gnPCxGcwmZqDSTgzxxWWVoASMFmgYkAAeRJTInN3ymj4d-jSCeNsMq-wuoPaOltigAKoASgAywhK7SbGQZIIz5VWCFzSeCrZagNYbChbHaxUDcCjJZLfSDbExIAgUdxkUBIursJzCFJtXydajBBCcQQ0MwAUVWDEQC0gADVHBQGNJ3KAALygABEAAkYNAMOB4GRonzFBTBPB3AERcwABS0+mM9ysygc9wASmCKhwzQ8ZC8iHFzmB7BoXzcZmY7AYzEg-Fg0HUiQ58D0Ii8fLpDKZgj5SWxfPADlQAHJhAA5SASPlBFQAeS+ZHegmdWkgR1QjgUrmkeFATjNOmGWH0KAQiGhwkuNok4uiIgMHGxCyYrA4PCCJSAA">Typescript Playground</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caf27f00cb1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create React App vs Vite React App]]></title>
            <link>https://medium.com/@dewandameena1098/create-react-app-vs-vite-react-app-6ad4e0a1f86d?source=rss-c5fc5ed66c85------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ad4e0a1f86d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ashish Kumar Meena]]></dc:creator>
            <pubDate>Thu, 20 Mar 2025 20:02:30 GMT</pubDate>
            <atom:updated>2025-03-20T20:05:29.102Z</atom:updated>
            <content:encoded><![CDATA[<p>command for create react app</p><pre>npx create-react-app app_name</pre><p>command for vite react app</p><pre>npm create vite@latest</pre><p>so let’s start with the main differences how these both technologies actually server the react app:</p><h4>1. how to run the react in both of these</h4><p>Go to each folder where package.json is present in both and run the following commands:</p><p>for create react app</p><pre>npm run start</pre><p>for vite react app</p><pre>npm run dev</pre><h4>2. How they inject Javascript in HTML</h4><blockquote>create react app uses <strong>react-scripts </strong>to inject javascript in index.html where as vite react app directly uses <strong>script tag</strong> in the index.html to inject javascript in the html</blockquote><h4>3. When to use js and jsx</h4><blockquote>In general when you are exporting html in a javascript function you use .jsx as file extension for that but in create react app you use .js or .jsx doesn’t matter as there rules are not that much strict but in vite react app you have to follow this convention otherwise it will give error.</blockquote><h4>4. Rule for components functions</h4><blockquote>in both these templates you have to keep first letter of component function in uppercase otherwise you will not be able to see the output and for filename it is convention follow above rules but if you don’t follow then also it doesnot matter that much it’s more of a personal choice.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ad4e0a1f86d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>