<?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: Vladyusha</title>
    <description>The latest articles on DEV Community by Vladyusha (@vladyusha).</description>
    <link>https://dev.to/vladyusha</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%2F1938179%2Facce81fb-adf7-456d-b6d3-acdb605d4561.jpg</url>
      <title>DEV Community: Vladyusha</title>
      <link>https://dev.to/vladyusha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vladyusha"/>
    <language>en</language>
    <item>
      <title>Why I Chose Copy-and-Paste Components Instead of an npm Package</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Wed, 29 Jul 2026 02:09:50 +0000</pubDate>
      <link>https://dev.to/vladyusha/why-i-chose-copy-and-paste-components-instead-of-an-npm-package-2g0e</link>
      <guid>https://dev.to/vladyusha/why-i-chose-copy-and-paste-components-instead-of-an-npm-package-2g0e</guid>
      <description>&lt;p&gt;If you've used React for a while, you've probably installed dozens of UI libraries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;some-ui-library
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It feels like the obvious solution.&lt;/p&gt;

&lt;p&gt;So when I started building &lt;strong&gt;Motoko UI&lt;/strong&gt;, I asked myself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Should this be another npm package?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer surprised me.&lt;/p&gt;

&lt;p&gt;I decided &lt;strong&gt;not&lt;/strong&gt; to build a traditional component library.&lt;/p&gt;

&lt;p&gt;Instead, every component is copied directly into your project.&lt;/p&gt;

&lt;p&gt;Here's why.&lt;/p&gt;




&lt;h2&gt;
  
  
  You Own the Code
&lt;/h2&gt;

&lt;p&gt;One thing always bothered me about traditional UI libraries.&lt;/p&gt;

&lt;p&gt;The moment you install them, part of your application lives inside &lt;code&gt;node_modules&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you need to tweak a component, you have three options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Override styles&lt;/li&gt;
&lt;li&gt;Wrap the component&lt;/li&gt;
&lt;li&gt;Fork the library&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of them feels ideal.&lt;/p&gt;

&lt;p&gt;With copy-and-paste components, the code becomes yours from day one.&lt;/p&gt;

&lt;p&gt;Rename it.&lt;/p&gt;

&lt;p&gt;Refactor it.&lt;/p&gt;

&lt;p&gt;Delete half of it.&lt;/p&gt;

&lt;p&gt;Change every animation.&lt;/p&gt;

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




&lt;h2&gt;
  
  
  No Black Boxes
&lt;/h2&gt;

&lt;p&gt;One of the best ways to learn React is by reading real components.&lt;/p&gt;

&lt;p&gt;When the code is inside your project, everything is transparent.&lt;/p&gt;

&lt;p&gt;You can immediately see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how state is managed&lt;/li&gt;
&lt;li&gt;how animations work&lt;/li&gt;
&lt;li&gt;how accessibility is handled&lt;/li&gt;
&lt;li&gt;how styles are structured&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing is hidden behind an API.&lt;/p&gt;




&lt;h2&gt;
  
  
  Easier to Customize
&lt;/h2&gt;

&lt;p&gt;Every project has different requirements.&lt;/p&gt;

&lt;p&gt;Different colors.&lt;/p&gt;

&lt;p&gt;Different spacing.&lt;/p&gt;

&lt;p&gt;Different animations.&lt;/p&gt;

&lt;p&gt;Different coding styles.&lt;/p&gt;

&lt;p&gt;Instead of designing hundreds of configuration options, I prefer something much simpler:&lt;/p&gt;

&lt;p&gt;Just edit the component.&lt;/p&gt;




&lt;h2&gt;
  
  
  Better Long-Term Stability
&lt;/h2&gt;

&lt;p&gt;Traditional packages evolve.&lt;/p&gt;

&lt;p&gt;APIs change.&lt;/p&gt;

&lt;p&gt;Breaking changes happen.&lt;/p&gt;

&lt;p&gt;Version conflicts appear.&lt;/p&gt;

&lt;p&gt;With copy-and-paste components, your project doesn't suddenly break because of a package update.&lt;/p&gt;

&lt;p&gt;The component becomes part of your codebase.&lt;/p&gt;

&lt;p&gt;You decide if—and when—to update it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Less Dependency Weight
&lt;/h2&gt;

&lt;p&gt;Every dependency introduces maintenance.&lt;/p&gt;

&lt;p&gt;Even a small package has to be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;installed&lt;/li&gt;
&lt;li&gt;versioned&lt;/li&gt;
&lt;li&gt;updated&lt;/li&gt;
&lt;li&gt;audited&lt;/li&gt;
&lt;li&gt;kept compatible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Copy-and-paste components avoid adding another runtime dependency.&lt;/p&gt;

&lt;p&gt;Once the component is in your project, it's simply your code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why the Registry Matters
&lt;/h2&gt;

&lt;p&gt;Copying code manually doesn't scale very well.&lt;/p&gt;

&lt;p&gt;That's why Motoko UI uses a registry compatible with the &lt;strong&gt;shadcn CLI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Installing a component is as simple as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add @motokoui/theme-switcher
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLI copies the files directly into your project.&lt;/p&gt;

&lt;p&gt;No runtime package.&lt;/p&gt;

&lt;p&gt;No hidden abstraction.&lt;/p&gt;

&lt;p&gt;Just React components you own.&lt;/p&gt;




&lt;h2&gt;
  
  
  Are npm Packages Bad?
&lt;/h2&gt;

&lt;p&gt;Not at all.&lt;/p&gt;

&lt;p&gt;They're the right choice for many things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;state management&lt;/li&gt;
&lt;li&gt;routing&lt;/li&gt;
&lt;li&gt;data fetching&lt;/li&gt;
&lt;li&gt;utilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But UI components are different.&lt;/p&gt;

&lt;p&gt;They almost always need customization.&lt;/p&gt;

&lt;p&gt;For that reason, I think owning the source code is a better developer experience.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building Motoko UI changed the way I think about component libraries.&lt;/p&gt;

&lt;p&gt;Instead of creating another package that developers depend on, I wanted to create a collection of components they could truly own.&lt;/p&gt;

&lt;p&gt;That philosophy influences every decision in the project—from the registry to the documentation to the component APIs.&lt;/p&gt;

&lt;p&gt;I'm curious where the React ecosystem goes next, but for now, I believe copy-and-paste components offer one of the best experiences for building modern applications.&lt;/p&gt;

&lt;p&gt;If you've built a component library yourself, I'd love to hear which approach you prefer: traditional npm packages or copy-and-paste components?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>react</category>
      <category>npm</category>
    </item>
    <item>
      <title>7 Lessons I Learned While Building an Open-Source React Component Library</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Wed, 29 Jul 2026 01:53:20 +0000</pubDate>
      <link>https://dev.to/vladyusha/7-lessons-i-learned-while-building-an-open-source-react-component-library-2hgn</link>
      <guid>https://dev.to/vladyusha/7-lessons-i-learned-while-building-an-open-source-react-component-library-2hgn</guid>
      <description>&lt;p&gt;A few weeks ago, I started building &lt;strong&gt;Motoko UI&lt;/strong&gt;, an open-source React component library.&lt;/p&gt;

&lt;p&gt;The goal sounded simple: build beautiful, reusable components.&lt;/p&gt;

&lt;p&gt;The reality was very different.&lt;/p&gt;

&lt;p&gt;Here are seven lessons I've learned so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Building Components Is the Easy Part
&lt;/h2&gt;

&lt;p&gt;The first few components took only a couple of days.&lt;/p&gt;

&lt;p&gt;The documentation took longer.&lt;/p&gt;

&lt;p&gt;The installation flow took longer.&lt;/p&gt;

&lt;p&gt;The registry took longer.&lt;/p&gt;

&lt;p&gt;It turns out that a component library is much more than a collection of components.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Developer Experience Matters More Than Fancy Animations
&lt;/h2&gt;

&lt;p&gt;A beautiful component is useless if developers struggle to install it.&lt;/p&gt;

&lt;p&gt;I quickly realized that reducing setup time was more valuable than adding another animation.&lt;/p&gt;

&lt;p&gt;That's why I invested time in a registry and simple installation flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Documentation Is Part of the Product
&lt;/h2&gt;

&lt;p&gt;I used to think documentation came after development.&lt;/p&gt;

&lt;p&gt;Now I think documentation &lt;em&gt;is&lt;/em&gt; development.&lt;/p&gt;

&lt;p&gt;If users can't quickly understand how to use a component, the component effectively doesn't exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Small Releases Keep You Moving
&lt;/h2&gt;

&lt;p&gt;Instead of waiting until everything was perfect, I started shipping small releases.&lt;/p&gt;

&lt;p&gt;Every release adds a few components, fixes issues, and improves documentation.&lt;/p&gt;

&lt;p&gt;That momentum makes the project feel alive.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Design Consistency Is Harder Than It Looks
&lt;/h2&gt;

&lt;p&gt;Every new component introduces new decisions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;spacing&lt;/li&gt;
&lt;li&gt;shadows&lt;/li&gt;
&lt;li&gt;colors&lt;/li&gt;
&lt;li&gt;border radius&lt;/li&gt;
&lt;li&gt;animation timing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without clear design principles, the library quickly becomes inconsistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Open Source Means Listening
&lt;/h2&gt;

&lt;p&gt;Some of the best ideas didn't come from me.&lt;/p&gt;

&lt;p&gt;They came from developers trying the project and asking:&lt;/p&gt;

&lt;p&gt;"What if this component supported...?"&lt;/p&gt;

&lt;p&gt;Those conversations improve the library more than coding alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. The Project Is Never Finished
&lt;/h2&gt;

&lt;p&gt;There's always another component.&lt;/p&gt;

&lt;p&gt;Another improvement.&lt;/p&gt;

&lt;p&gt;Another refactor.&lt;/p&gt;

&lt;p&gt;I've stopped thinking about "finishing" the library.&lt;/p&gt;

&lt;p&gt;Now the goal is simply to make it a little better with every release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building Motoko UI has already taught me far more than I expected.&lt;/p&gt;

&lt;p&gt;Whether the project ends up with 100 stars or 10,000, the experience of designing, documenting, and maintaining an open-source library has been worth it.&lt;/p&gt;

&lt;p&gt;If you're thinking about starting your own open-source project, my advice is simple:&lt;/p&gt;

&lt;p&gt;Start before you think you're ready.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://www.motokoui.com" rel="noopener noreferrer"&gt;Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/motoko-ui/motokoui" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>shadc</category>
      <category>webcomponents</category>
      <category>reactlibrary</category>
    </item>
    <item>
      <title>I Built Another React UI Library — Here's Why</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Wed, 29 Jul 2026 01:49:17 +0000</pubDate>
      <link>https://dev.to/vladyusha/i-built-another-react-ui-library-heres-why-3k7p</link>
      <guid>https://dev.to/vladyusha/i-built-another-react-ui-library-heres-why-3k7p</guid>
      <description>&lt;p&gt;If you've been building React apps for a while, you've probably had the same thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Not another React UI library..."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Honestly, I had it too.&lt;/p&gt;

&lt;p&gt;The ecosystem already has amazing projects like shadcn/ui, Magic UI, Aceternity UI, Origin UI, and many others.&lt;/p&gt;

&lt;p&gt;So why would anyone build another one?&lt;/p&gt;

&lt;h2&gt;
  
  
  It Started With Copying the Same Components
&lt;/h2&gt;

&lt;p&gt;Every new project looked familiar.&lt;/p&gt;

&lt;p&gt;I needed a modal.&lt;br&gt;
Then tabs.&lt;br&gt;
A tooltip.&lt;br&gt;
A navigation menu.&lt;br&gt;
A badge.&lt;br&gt;
A hero section.&lt;/p&gt;

&lt;p&gt;Sometimes I'd build them from scratch.&lt;br&gt;
Sometimes I'd copy them from an old project.&lt;br&gt;
Sometimes I'd spend an hour tweaking styles to match a new design.&lt;/p&gt;

&lt;p&gt;Eventually I realized I wasn't building products—I was rebuilding the same UI over and over again.&lt;/p&gt;

&lt;h2&gt;
  
  
  I Wanted Components That Felt Production-Ready
&lt;/h2&gt;

&lt;p&gt;Many libraries solve the problem of functionality.&lt;/p&gt;

&lt;p&gt;I wanted to focus on something slightly different.&lt;/p&gt;

&lt;p&gt;I wanted components that looked polished out of the box while still being easy to customize.&lt;/p&gt;

&lt;p&gt;That meant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modern design&lt;/li&gt;
&lt;li&gt;Smooth animations&lt;/li&gt;
&lt;li&gt;Clean code&lt;/li&gt;
&lt;li&gt;TypeScript-first&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;Easy installation&lt;/li&gt;
&lt;li&gt;No unnecessary abstractions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Not Just Use shadcn/ui?
&lt;/h2&gt;

&lt;p&gt;I actually do.&lt;/p&gt;

&lt;p&gt;Motoko UI isn't trying to replace shadcn/ui.&lt;/p&gt;

&lt;p&gt;Instead, I see it as an extension of that ecosystem.&lt;/p&gt;

&lt;p&gt;If shadcn/ui gives you the building blocks, Motoko UI focuses on higher-level components, interactive elements, and polished UI patterns that you can drop into real applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building in Public
&lt;/h2&gt;

&lt;p&gt;One decision I made early was to build everything in public.&lt;/p&gt;

&lt;p&gt;Every component.&lt;br&gt;
Every release.&lt;br&gt;
Every improvement.&lt;/p&gt;

&lt;p&gt;That keeps me accountable and gives other developers the opportunity to suggest ideas before they become part of the library.&lt;/p&gt;

&lt;h2&gt;
  
  
  The First Releases
&lt;/h2&gt;

&lt;p&gt;So far I've added components like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accordion&lt;/li&gt;
&lt;li&gt;Animated Tabs&lt;/li&gt;
&lt;li&gt;Waves Shader&lt;/li&gt;
&lt;li&gt;Theme Switcher&lt;/li&gt;
&lt;li&gt;Badge&lt;/li&gt;
&lt;li&gt;Modal&lt;/li&gt;
&lt;li&gt;Tooltip&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Along with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Documentation&lt;/li&gt;
&lt;li&gt;Registry support&lt;/li&gt;
&lt;li&gt;Backgrounds &amp;amp; Shaders&lt;/li&gt;
&lt;li&gt;Simple installation through the shadcn CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's still a small project, but it's growing with every release.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Comes Next
&lt;/h2&gt;

&lt;p&gt;My goal isn't to create the biggest component library.&lt;/p&gt;

&lt;p&gt;I want to create one that developers genuinely enjoy using.&lt;/p&gt;

&lt;p&gt;Over the coming months, I'll be adding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dashboard components&lt;/li&gt;
&lt;li&gt;Landing page sections&lt;/li&gt;
&lt;li&gt;More shaders and animated backgrounds&lt;/li&gt;
&lt;li&gt;Data visualization components&lt;/li&gt;
&lt;li&gt;Better documentation&lt;/li&gt;
&lt;li&gt;More polished developer experience&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  I'd Love Your Feedback
&lt;/h2&gt;

&lt;p&gt;Open source gets better through feedback.&lt;/p&gt;

&lt;p&gt;If you have ideas for components, improvements, or features you'd like to see, let me know.&lt;/p&gt;

&lt;p&gt;And if you think Motoko UI is useful, I'd really appreciate a ⭐ on GitHub.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://www.motokoui.com" rel="noopener noreferrer"&gt;Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/motoko-ui/motokoui" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>react</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Just Launched My Side Project — Would Love Your Feedback! 🚀</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Tue, 25 Feb 2025 08:57:13 +0000</pubDate>
      <link>https://dev.to/vladyusha/just-launched-my-side-project-would-love-your-feedback-4ilb</link>
      <guid>https://dev.to/vladyusha/just-launched-my-side-project-would-love-your-feedback-4ilb</guid>
      <description>&lt;p&gt;Hey everyone! 👋 &lt;/p&gt;

&lt;p&gt;I’ve been working on a little side project called &lt;a href="https://rinkuit.space" rel="noopener noreferrer"&gt;Rinkuit&lt;/a&gt;, and I’d love for you to check it out! It’s nothing too fancy, just something I built in my spare time, but I’m pretty excited about it. I’d really appreciate it if you could take a look, click around, and let me know what you think. Feedback is super welcome—good, bad, or ugly! 😄 &lt;/p&gt;

&lt;p&gt;👉 Visit &lt;a href="https://rinkuit.space" rel="noopener noreferrer"&gt;Rinkuit&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Thanks in advance, you’re awesome! 🙌&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>saas</category>
      <category>founder</category>
      <category>react</category>
    </item>
    <item>
      <title>What’s New in React 19? A Quick Guide with Code Examples</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Mon, 02 Dec 2024 22:47:31 +0000</pubDate>
      <link>https://dev.to/vladyusha/whats-new-in-react-19-a-quick-guide-with-code-examples-2eab</link>
      <guid>https://dev.to/vladyusha/whats-new-in-react-19-a-quick-guide-with-code-examples-2eab</guid>
      <description>&lt;p&gt;&lt;strong&gt;React 19&lt;/strong&gt; has arrived, bringing new features that make our apps faster and smarter while making development smoother. Here’s a quick look at the top highlights, complete with code snippets to get you started. 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Enhanced Server Components
&lt;/h3&gt;

&lt;p&gt;Server Components are now easier to use and more powerful. You can mix server-rendered and client-rendered components seamlessly.&lt;/p&gt;

&lt;p&gt;Here’s a simple 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="c1"&gt;// Server Component&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ServerComponent&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;rendered&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Client Component&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ServerComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./ServerComponent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ClientComponent&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="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ServerComponent&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;part&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;interactive&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;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;&lt;em&gt;Result: Faster initial load times and better interactivity.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Smarter Concurrent Rendering
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;React 19&lt;/strong&gt; fine-tunes concurrent rendering. With &lt;code&gt;useTransition&lt;/code&gt;, you can prioritize urgent updates while deferring others.&lt;/p&gt;

&lt;p&gt;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;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;startTransition&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTransition&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;startTransition&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;setExpensiveState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;someLargeData&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;&lt;em&gt;Users won’t experience lag while React processes updates in the background.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Auto-Bundling for Lazy Components
&lt;/h3&gt;

&lt;p&gt;Lazy-loading components is now simpler with auto-bundling, which ensures that only the required code is loaded.&lt;/p&gt;

&lt;p&gt;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;const&lt;/span&gt; &lt;span class="nx"&gt;LazyComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lazy&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./LazyComponent&lt;/span&gt;&lt;span class="dl"&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;App&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="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Suspense&lt;/span&gt; &lt;span class="nx"&gt;fallback&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;}&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;LazyComponent&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Suspense&lt;/span&gt;&lt;span class="err"&gt;&amp;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;&lt;em&gt;No extra configurations—React handles the bundling for you!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Faster Hydration
&lt;/h3&gt;

&lt;p&gt;Hydration is now selective, meaning React hydrates only what’s visible first. No extra code is needed—it’s enabled out of the box.&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="c1"&gt;// In React 19, hydration automatically prioritizes critical content:&lt;/span&gt;
&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hydrateRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;This speeds up interactivity for users with large apps.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. New Hooks: &lt;code&gt;useOptimistic&lt;/code&gt; and &lt;code&gt;useEvent&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;useOptimistic&lt;/code&gt; hook simplifies optimistic UI updates by managing temporary state.&lt;br&gt;
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;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;optimisticLikes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setOptimisticLikes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useOptimistic&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;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newLike&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;prev&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;newLike&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;handleLike&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setOptimisticLikes&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="c1"&gt;// Update UI instantly&lt;/span&gt;
  &lt;span class="nf"&gt;postLikeToServer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;    &lt;span class="c1"&gt;// Sync with server in the background&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Instant feedback for users, even with slow network responses.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;useEvent&lt;/code&gt; helps with stable event handlers, avoiding unnecessary re-renders.&lt;br&gt;
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;const&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useEvent&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button clicked!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&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;Click&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Cleaner code and improved performance in scenarios with frequent event handling.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;React 19&lt;/strong&gt; is all about speed, efficiency, and developer happiness. From smarter hydration to exciting new hooks.&lt;/p&gt;

&lt;p&gt;What feature are you most excited about? Share your thoughts in the comments!&lt;/p&gt;

&lt;p&gt;More features &lt;a href="https://react.dev/blog/2024/04/25/react-19" rel="noopener noreferrer"&gt;https://react.dev/blog/2024/04/25/react-19&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>The Operator Survival Guide for TypeScript Devs</title>
      <dc:creator>Vladyusha</dc:creator>
      <pubDate>Tue, 26 Nov 2024 15:54:57 +0000</pubDate>
      <link>https://dev.to/vladyusha/the-operator-survival-guide-for-typescript-devs-4e3o</link>
      <guid>https://dev.to/vladyusha/the-operator-survival-guide-for-typescript-devs-4e3o</guid>
      <description>&lt;p&gt;&lt;strong&gt;Picture this&lt;/strong&gt;: You're debugging your TypeScript code at &lt;strong&gt;2 a.m.&lt;/strong&gt;&lt;br&gt;
Sipping on your nth &lt;strong&gt;cup of coffee&lt;/strong&gt;(I don't drink coffee), and staring at &lt;strong&gt;line&lt;/strong&gt; 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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* mysterious bug */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;“What's the problem? They look equal enough!”&lt;/em&gt; you think. But then you remember your strict buddy &lt;code&gt;===&lt;/code&gt;, who clearly needs to step in here.&lt;/p&gt;

&lt;p&gt;TypeScript, like any good mentor, loves precision and order. Operators are its way of making sure your code knows exactly what you want from it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In this article&lt;/strong&gt;, we'll dive into the world of &lt;strong&gt;TypeScript operators&lt;/strong&gt;, discover who they are, how they differ, and when to befriend them (or avoid them entirely).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Content:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Logical operators&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Relational operators&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bitwise operators&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ternary Operator&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Type Operators&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&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%2F6a27fjincl79xt1w7e4w.png" 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%2F6a27fjincl79xt1w7e4w.png" alt="first" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Logical operators
&lt;/h2&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Logical AND (&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; operator checks if &lt;strong&gt;both conditions&lt;/strong&gt; are true. If one fails, it's game over.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
Imagine you're trying to buy snacks from vending machine. You need &lt;strong&gt;money&lt;/strong&gt; and the machine needs to works.&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;hasMoney&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;machineWorks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hasMoney&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;machineWorks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Yay! Got my snack!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;No snack for you.&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“I had the money, but the machine didn't cooperate. Guess I'm snackless today.”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Logical OR (&lt;code&gt;||&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;: &lt;br&gt;
The &lt;code&gt;||&lt;/code&gt; operator checks if &lt;strong&gt;at least one condition&lt;/strong&gt; is true. It's all about backup plans!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
You're craving pizza, but the local pizza is closed. Luckily, you've got leftovers in the fridge.&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;pizzaPlaceOpen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;haveLeftovers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pizzaPlaceOpen&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;haveLeftovers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Dinner is saved!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Time to go hungry.&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“Pizza place closed? No problem. Cold pizza it is!”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Logical NOT (&lt;code&gt;!&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;: &lt;br&gt;
The &lt;code&gt;!&lt;/code&gt; operator flips a condition. True becomes false, and false becomes true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
Your friends says they're not coming to the party. But you know them: if they says no, it usually means yes.&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;friendSaidNo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&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;friendSaidNo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Surprise! They’re at the party!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Guess they’re serious this time.&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“Told you, they always show up last minute!”&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Relational Operators in Action (&lt;code&gt;==&lt;/code&gt;, &lt;code&gt;===&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;!==&lt;/code&gt;)&lt;/strong&gt;
&lt;/h2&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Equality (&lt;code&gt;==&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;==&lt;/code&gt; operator checks if &lt;strong&gt;two values are loosely equal&lt;/strong&gt;. It doesn’t care about their type, as long as they look the same.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine your friend asks for “5 apples,” but you only have “5” written on a sticky note. They shrug and say, &lt;em&gt;“Close enough!”&lt;/em&gt;&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;applesOnNote&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;applesNeeded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;applesOnNote&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;applesNeeded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Good enough, I’ll take it.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Nope, I need *real* apples.&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“Turns out, a number written on paper isn’t quite the same as an actual apple.”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Strict Equality (&lt;code&gt;===&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;===&lt;/code&gt; operator is more &lt;em&gt;picky&lt;/em&gt;. It checks both value and &lt;em&gt;type&lt;/em&gt;. No shortcuts here!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
This time, your friend insists: &lt;em&gt;“I need 5 actual apples, not just a sticky note with the number!”&lt;/em&gt;&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;applesOnNote&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;applesNeeded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Perfect, these are actual apples.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Hey, this is just a note! Not what I asked for!&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“Lesson learned: Strict friends need strict checks.”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Inequality (&lt;code&gt;!=&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;!=&lt;/code&gt; operator checks if two values are &lt;strong&gt;not loosely equal.&lt;/strong&gt; It doesn’t mind small mismatches, like different types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
You promise your friend you’ll bring “not oranges.” You show up with a basket of bananas.&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;fruitBrought&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bananas&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruitBrought&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;oranges&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Thanks! At least it’s not oranges.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Seriously? I said no oranges!&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“Bananas passed the test, but only because the bar was so low.”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Strict Inequality (&lt;code&gt;!==&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;!==&lt;/code&gt; operator makes sure values are &lt;strong&gt;not equal&lt;/strong&gt; in value or type. It’s the strict version of &lt;code&gt;!=&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Your friend clarifies: &lt;em&gt;“I don’t just want ‘not oranges,’ I want something completely different, like actual fruit!”&lt;/em&gt;&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;gift&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gift&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;oranges&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Thanks, this is acceptable.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Friend: Come on, I said no oranges, and this is one.&lt;/span&gt;&lt;span class="dl"&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;&lt;em&gt;“When your friend’s picky, even being close isn’t good enough.”&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;em&gt;Let's get some rest&lt;/em&gt;
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Here you can go with a cup of tea or coffee&lt;/p&gt;
&lt;/blockquote&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%2Fy2gjkvzbiibg0falkckf.jpg" 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%2Fy2gjkvzbiibg0falkckf.jpg" alt="second" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Bitwise Operators in Action&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;"When your computer starts playing with bits like building blocks."&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Bitwise AND (&lt;code&gt;&amp;amp;&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;&amp;amp;&lt;/code&gt; operator compares two numbers bit by bit and keeps a &lt;code&gt;1&lt;/code&gt; only where &lt;strong&gt;both bits are&lt;/strong&gt; &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine two friends trying to agree on a movie night. They’ll only go if both want to see the same movie.&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;myPreference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mb"&gt;0b1010&lt;/span&gt; &lt;span class="c1"&gt;// Movies A and C&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;friendPreference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mb"&gt;0b1100&lt;/span&gt; &lt;span class="c1"&gt;// Movies B and C&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mutualChoice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myPreference&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;friendPreference&lt;/span&gt; &lt;span class="c1"&gt;// Only C (0b1000)&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;mutualChoice&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Movie night is on!&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="s2"&gt;No agreement, no movie.&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;&lt;em&gt;"Friendship survives, but only if we both agree!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Bitwise OR (&lt;code&gt;|&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;|&lt;/code&gt; operator compares two numbers bit by bit and keeps a &lt;code&gt;1&lt;/code&gt; if &lt;strong&gt;either bit is&lt;/strong&gt; &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
This time, you and your friend decide to list all the movies you’d consider watching — even if only one of you likes them.&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;combinedChoices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myPreference&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;friendPreference&lt;/span&gt; &lt;span class="c1"&gt;// A, B, C (0b1110)&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Here’s our list of possible movies:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;combinedChoices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Compromise: we’ll pick from everyone’s favorites!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Bitwise XOR (&lt;code&gt;^&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;^&lt;/code&gt; operator compares two numbers bit by bit and keeps a &lt;code&gt;1&lt;/code&gt; only where &lt;strong&gt;the bits are different&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
You and your friend each make a unique suggestion for dinner. XOR helps filter out any overlap.&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;uniqueChoices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myPreference&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="nx"&gt;friendPreference&lt;/span&gt; &lt;span class="c1"&gt;// A and B (0b0110)&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;These are unique picks:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;uniqueChoices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Let’s focus on what makes us different — in a good way!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Bitwise NOT (&lt;code&gt;~&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;~&lt;/code&gt; operator flips all the bits of a number. A &lt;code&gt;1&lt;/code&gt; becomes &lt;code&gt;0&lt;/code&gt;, and vice versa.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Your pessimistic friend looks at your list and says, &lt;em&gt;“Here’s what’s NOT on the table.”&lt;/em&gt;&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;allOptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mb"&gt;0b1111&lt;/span&gt; &lt;span class="c1"&gt;// All movies&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;notMyPreference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;myPreference&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;allOptions&lt;/span&gt; &lt;span class="c1"&gt;// Movies B and D&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Movies I don’t want:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;notMyPreference&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Fine, let’s skip my least favorites..."&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Left Shift (&lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; operator moves the bits of a number to the left, filling in with zeroes on the right. It’s like multiplying by 2 for every shift.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine packing for a trip. Each bag can hold double the amount if you rent a bigger car.&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;bags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mb"&gt;0b0010&lt;/span&gt; &lt;span class="c1"&gt;// 2 bags&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;biggerCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bags&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="c1"&gt;// 8 bags&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;We can pack this many bags now:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;biggerCar&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Time to bring more snacks!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Sign-propagating Right Shift (&lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; operator shifts bits to the right, keeping the sign (positive or negative). It’s like dividing by 2 for every shift.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
You’re splitting up leftovers. Start with a big portion and share until it’s all gone.&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;let&lt;/span&gt; &lt;span class="nx"&gt;leftovers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mb"&gt;0b1000&lt;/span&gt; &lt;span class="c1"&gt;// 8 portions&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextPortion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;leftovers&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;// 4 portions&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Leftovers after sharing:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;nextPortion&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Sharing is caring, but don’t leave me hungry!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Zero-fill Right Shift (&lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt; operator shifts bits to the right, filling with zeroes. It works the same for positive numbers but ignores signs for negatives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine clearing out space in your garage by throwing out junk. New space is always clean (zeros).&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;junk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="c1"&gt;// Negative binary&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;clearedSpace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;junk&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cleaned-up garage space:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;clearedSpace&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"Who cares if it’s negative? Clean slate it is!"&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Ternary Operator&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
The ternary operator (&lt;code&gt;condition ? expressionIfTrue : expressionIfFalse&lt;/code&gt;) is a shorthand for making quick decisions. Think of it as flipping a coin when you need to make a choice, but smarter — it looks at the condition and picks the right answer for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine you’re deciding whether to take an umbrella before heading out. If it’s raining, you take one; otherwise, you don’t bother.&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;isRaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;umbrella&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;isRaining&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Take the umbrella!&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="s2"&gt;No umbrella needed.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;umbrella&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"The sky decides for me: rain or shine, I’m ready!"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When NOT to use it:&lt;/strong&gt;&lt;br&gt;
The ternary operator is great for short and simple choices, but if you’re stacking a dozen conditions, you’ll end up with something that looks like a spaghetti monster:&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="c1"&gt;// Don’t do this!&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mood&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;isRaining&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sad&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;isSunny&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;isCloudy&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;meh&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="s2"&gt;confused&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;&lt;em&gt;"Readable code is happy code. Don’t overdo it!"&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Type Operators&lt;/strong&gt;
&lt;/h2&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;typeof&lt;/code&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;typeof&lt;/code&gt; operator is like a detective — it checks the type of a value at runtime or extracts the type of a variable for use in your TypeScript code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine someone hands you a mystery box. You use a label scanner (&lt;code&gt;typeof&lt;/code&gt;) to figure out if it’s a fruit or a gadget.&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;mysteryBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;boxType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;mysteryBox&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;boxType&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&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="s2"&gt;It’s a fruit!&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="s2"&gt;Unknown gadget.&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;&lt;em&gt;"When in doubt, always check the label."&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;keyof&lt;/code&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
The &lt;code&gt;keyof&lt;/code&gt; operator creates a type that includes all the keys of an object. Think of it as flipping through a dictionary to see all the available words.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Your friend hands you a shopping list, and you check what categories (keys) they’ve written down:&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;ShoppingList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;fruits&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="na"&gt;veggies&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="na"&gt;snacks&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;type&lt;/span&gt; &lt;span class="nx"&gt;ListCategories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;ShoppingList&lt;/span&gt; &lt;span class="c1"&gt;// 'fruits' | 'veggies' | 'snacks'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chosenCategory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ListCategories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fruits&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// valid!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"When you know all the categories, choosing one is easy!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;Mapped Types&lt;/code&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
Mapped types let you apply the same transformation to all properties of a type. Think of it as photocopying a document but adding a filter to every page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Suppose you have a task list, and you need to mark every task as optional.&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;TaskList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;homework&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="na"&gt;chores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="na"&gt;shopping&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="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;OptionalTaskList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;TaskList&lt;/span&gt;&lt;span class="p"&gt;]?:&lt;/span&gt; &lt;span class="nx"&gt;TaskList&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Result: All tasks become optional&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myTasks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;OptionalTaskList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;homework&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Math&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// Valid!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"It’s like giving yourself an excuse to skip a task — because now it’s optional!"&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;Conditional Types&lt;/code&gt;&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; &lt;br&gt;
Conditional types let you write logic to decide between types based on conditions. It’s like asking, &lt;em&gt;“If this happens, what should I do?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Imagine deciding the size of a meal based on hunger.&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;MealSize&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HungerLevel&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;HungerLevel&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;starving&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="s2"&gt;large&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="s2"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;MyMeal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;MealSize&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;starving&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// 'large'&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;FriendMeal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;MealSize&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;full&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// 'small'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;"If you’re starving, go big. If you’re full, maybe just dessert!"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Use:&lt;/strong&gt;&lt;br&gt;
Conditional types are powerful for creating reusable, dynamic types in your code. 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;Response&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&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="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;error&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;&lt;em&gt;"Adapt your type to the situation!"&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  A Quick Note from Your Friendly Guide
&lt;/h3&gt;

&lt;p&gt;Before we wrap up, I have to confess: I didn’t include &lt;strong&gt;every single operator&lt;/strong&gt; here. Why? Well, some operators are so simple they don’t need much explaining (like the classic &lt;code&gt;=&lt;/code&gt; — we’ve all seen that one in action). Others just didn’t make the cut because I wanted to keep things snappy and focus on the fun and fascinating ones.  &lt;/p&gt;

&lt;p&gt;But hey, don’t just take my word for it! TypeScript has a &lt;strong&gt;treasure trove of operators&lt;/strong&gt; waiting for you to explore. Head over to the &lt;a href="https://www.typescriptlang.org/docs/" rel="noopener noreferrer"&gt;official TypeScript documentation&lt;/a&gt; and give them a look. Trust me, your future self (and your code) will thank you.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Because even the small and simple operators deserve some love, right?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;End&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thx for reading)&lt;/p&gt;

&lt;p&gt;Subscribe to my &lt;strong&gt;&lt;a href="https://t.me/+XKmczhp5pfExOTJi" rel="noopener noreferrer"&gt;telegram&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
