<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Arafat</title>
    <description>The latest articles on Forem by Arafat (@arafat4693).</description>
    <link>https://forem.com/arafat4693</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F994177%2F604285ca-6040-484c-9335-317563fe967c.png</url>
      <title>Forem: Arafat</title>
      <link>https://forem.com/arafat4693</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/arafat4693"/>
    <language>en</language>
    <item>
      <title>The Weird Side Of JavaScript</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Fri, 09 Feb 2024 08:30:19 +0000</pubDate>
      <link>https://forem.com/arafat4693/the-weird-side-of-javascript-5kl</link>
      <guid>https://forem.com/arafat4693/the-weird-side-of-javascript-5kl</guid>
      <description>&lt;p&gt;JavaScript has its quirks. In this blog post, we’ll explore the weird side of JavaScript that may leave you scratching your head. These quirks are not necessarily &lt;strong&gt;bad&lt;/strong&gt; or &lt;strong&gt;wrong&lt;/strong&gt; but are intriguing.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧭Table Of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Arrays equal strings&lt;/li&gt;
&lt;li&gt;Arrays are not equal&lt;/li&gt;
&lt;li&gt;Numbers are sorted alphabetically&lt;/li&gt;
&lt;li&gt;String is not a string&lt;/li&gt;
&lt;li&gt;Null comparison&lt;/li&gt;
&lt;li&gt;NaN is a number&lt;/li&gt;
&lt;li&gt;Arrays and objects&lt;/li&gt;
&lt;li&gt;Boolean maths&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Arrays equal strings
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0, 1, 2&lt;/span&gt;&lt;span class="dl"&gt;'&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;c&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="c1"&gt;// true&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="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Arrays are not equal
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;    &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;     &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&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="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;     &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Numbers are sorted alphabetically
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&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="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// [0, 1, 10, 2, 3, 8, 9];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  String is not a string
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Arafat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;             &lt;span class="c1"&gt;// "string"&lt;/span&gt;

&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Arafat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Null comparison
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;                &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;                &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;               &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;               &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;               &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;             &lt;span class="c1"&gt;// "object"&lt;/span&gt;

&lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;  &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  NaN is a number
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt;       &lt;span class="c1"&gt;// 'Number'&lt;/span&gt;

&lt;span class="mi"&gt;123&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;      &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt;      &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Arrays and objects
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;     &lt;span class="c1"&gt;// ""&lt;/span&gt;

&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;     &lt;span class="c1"&gt;// "[object Object]"&lt;/span&gt;

&lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;     &lt;span class="c1"&gt;// 0&lt;/span&gt;

&lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;     &lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Boolean maths
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;           &lt;span class="c1"&gt;// 1&lt;/span&gt;

&lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;    &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Don't worry. It stops to get weird if you know why. 🙈&lt;/p&gt;

&lt;p&gt;🎉Don't forget to save the post&lt;/p&gt;

&lt;p&gt;Do Like 👍 &amp;amp; Share 🔄&lt;/p&gt;

&lt;p&gt;Follow &lt;strong&gt;me&lt;/strong&gt; for more amazing content related to Programming &amp;amp; Web Development 🚀&lt;/p&gt;

&lt;p&gt;Credit: @thecodecrumbs🔥&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Best Animation Libraries For React🎉</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Fri, 09 Jun 2023 18:57:50 +0000</pubDate>
      <link>https://forem.com/arafat4693/best-animation-libraries-for-react-156n</link>
      <guid>https://forem.com/arafat4693/best-animation-libraries-for-react-156n</guid>
      <description>&lt;p&gt;Today, Web application user interfaces have many elements that make them appealing to users. Developers have had to find new ways of implementing UIs with animation and transitions to meet these modern requirements. &lt;/p&gt;

&lt;p&gt;As a result, specialized libraries and tools have been developed to handle animation in web apps. In this article, I will discuss some best React animation libraries I have experience with to help you choose the best one for your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧭Table Of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
1. React Spring

&lt;ul&gt;
&lt;li&gt;Features Of React Spring&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

2. Framer Motion

&lt;ul&gt;
&lt;li&gt;Features Of Framer Motion&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

3. TS Particles

&lt;ul&gt;
&lt;li&gt;Features Of TS Particles&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

4. Green Sock

&lt;ul&gt;
&lt;li&gt;Features Of Green Sock&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

5. Remotion

&lt;ul&gt;
&lt;li&gt;Features Of Remotion&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

6. React Move

&lt;ul&gt;
&lt;li&gt;Features Of React Move&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

7. React Awesome Reveal

&lt;ul&gt;
&lt;li&gt;Features Of React Awesome Reveal&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. React Spring
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdho0d0pdkndpizsa4rh3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdho0d0pdkndpizsa4rh3.png" alt="React Spring"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.react-spring.dev/" rel="noopener noreferrer"&gt;React-spring&lt;/a&gt; is a spring-physics-based animation library that should cover most of your UI-related animation needs. It gives you flexible tools to confidently cast your ideas into moving interfaces.&lt;/p&gt;

&lt;p&gt;React Spring has over 25,000 &lt;a href="https://github.com/pmndrs/react-spring" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 750k weekly &lt;a href="https://www.npmjs.com/package/react-spring" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features Of React Spring
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Smooth and fluid animations for React applications&lt;/li&gt;
&lt;li&gt;Physics-based animations for natural and realistic effects&lt;/li&gt;
&lt;li&gt;Fine-grained control over animation parameters&lt;/li&gt;
&lt;li&gt;Supports complex animations involving multiple elements&lt;/li&gt;
&lt;li&gt;Seamless integration with React&lt;/li&gt;
&lt;li&gt;Cross-browser and cross-device compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Framer Motion
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fzvtthhte55lcueabpzy0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fzvtthhte55lcueabpzy0.png" alt="Framer Motion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.framer.com/motion/" rel="noopener noreferrer"&gt;Framer Motion&lt;/a&gt; 💘 (a personal favorite) A production-ready motion library for React. Utilize the power behind Framer, the best prototyping tool for teams. Proudly open source.&lt;/p&gt;

&lt;p&gt;Framer Motion has over 18,000 &lt;a href="https://github.com/framer/motion" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 2.2M weekly &lt;a href="https://www.npmjs.com/package/framer-motion" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features Of Framer Motion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Easy-to-use syntax for creating stunning animations&lt;/li&gt;
&lt;li&gt;Supports a wide range of elements and UI components&lt;/li&gt;
&lt;li&gt;Customizable options for fine-tuning animations&lt;/li&gt;
&lt;li&gt;Gesture support for interactive interactions&lt;/li&gt;
&lt;li&gt;Built-in SVG animation capabilities&lt;/li&gt;
&lt;li&gt;Variant system for creating reusable animations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. TS Particles
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fap59fwmhzfx97q7f6ab3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fap59fwmhzfx97q7f6ab3.png" alt="TS Particles"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://particles.js.org/" rel="noopener noreferrer"&gt;tsParticles&lt;/a&gt; - Easily create highly customizable particles, confetti, and fireworks animations and use them as animated backgrounds for your website. Ready-to-use components available for Reacts, Angular, Svelte, and Web Components.&lt;/p&gt;

&lt;p&gt;TS Particles has over 5,500 &lt;a href="https://github.com/matteobruni/tsparticles" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 54k weekly &lt;a href="https://www.npmjs.com/package/tsparticles" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features Of TS Particles
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stunning particle animations for visually captivating websites&lt;/li&gt;
&lt;li&gt;Customizable configurations for size, shape, color, and behavior of particles&lt;/li&gt;
&lt;li&gt;Interactive interactions with mouse and touch interactions&lt;/li&gt;
&lt;li&gt;Performance optimization for smooth animations on all devices&lt;/li&gt;
&lt;li&gt;Easy integration with vanilla JavaScript or popular frameworks like React and Vue&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Green Sock
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsbcyt0bwq064i6rqz9f1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsbcyt0bwq064i6rqz9f1.png" alt="Green Sock"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://greensock.com/docs/v3/Installation" rel="noopener noreferrer"&gt;gsap- GreenSock Animation Platform (GSAP)&lt;/a&gt; animates anything&lt;br&gt;
favaSritcan touch (CSS properties, SVG, React Canvas, Generic&lt;br&gt;
objects, whatever) and solves countless browser inconsistencies, all with blazing speed.&lt;/p&gt;

&lt;p&gt;Green Sock has over 16,400 &lt;a href="https://github.com/greensock/GSAP" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 400k weekly &lt;a href="https://www.npmjs.com/package/gsap" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Features Of Green Sock
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Versatile animations with tweens, timelines, and morphs&lt;/li&gt;
&lt;li&gt;Cross-browser compatibility for consistent experiences&lt;/li&gt;
&lt;li&gt;High performance with smooth animations and efficient resource utilization&lt;/li&gt;
&lt;li&gt;Fine-grained control over animation parameters&lt;/li&gt;
&lt;li&gt;Advanced SVG animation capabilities, including morphing and path animation&lt;/li&gt;
&lt;li&gt;Scroll-driven animations for captivating effects&lt;/li&gt;
&lt;li&gt;Vast plugin ecosystem for extending capabilities with physics-based animations, motion paths, and more.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  5. Remotion
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpri9hl3zqsleevlptcrs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpri9hl3zqsleevlptcrs.png" alt="Remotion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.remotion.dev/" rel="noopener noreferrer"&gt;Remotion&lt;/a&gt; allows you to create videos and animation using familiar tools and languages like HTML, CSS, JavaScript, and TypeScript. So, you can learn about video creation without any knowledge. Instead, you can use your expertise in programming to create animation and videos using Remotion.&lt;/p&gt;

&lt;p&gt;Remotion has more than 16,000 &lt;a href="https://github.com/remotion-dev/remotion#readme" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 14k weekly &lt;a href="https://www.npmjs.com/package/remotion" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Features Of Remotion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Browser-based video creation using React components&lt;/li&gt;
&lt;li&gt;Powerful timeline editor for sequencing and animating components&lt;/li&gt;
&lt;li&gt;Dynamic content generation with props for personalized and data-driven videos&lt;/li&gt;
&lt;li&gt;Code-driven customization and manipulation with JavaScript&lt;/li&gt;
&lt;li&gt;High-quality output in various formats and resolutions&lt;/li&gt;
&lt;li&gt;Collaboration and version control support with Git integration&lt;/li&gt;
&lt;li&gt;Seamless integration with existing React workflows and tooling&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  6. React Move
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fiiysde7m262bl9i8pvvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fiiysde7m262bl9i8pvvc.png" alt="React Move"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-move-docs.netlify.app/" rel="noopener noreferrer"&gt;React Move&lt;/a&gt; allows developers to make attractive, data-driven animations. It is a lightweight library that has lifecycle events on transitions.&lt;/p&gt;

&lt;p&gt;React Move has more than 6,500 &lt;a href="https://github.com/sghall/react-move#readme" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 90,00 weekly &lt;a href="https://www.npmjs.com/package/react-move" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Features Of React Move
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Declarative syntax for defining animations in React applications&lt;/li&gt;
&lt;li&gt;Multiple animation types available (translate, scale, rotate, opacity)&lt;/li&gt;
&lt;li&gt;Customizable transitions with control over timing, duration, and easing&lt;/li&gt;
&lt;li&gt;Interpolation and interpolation functions for smooth transitions&lt;/li&gt;
&lt;li&gt;SVG animation support for animating SVG elements and attributes&lt;/li&gt;
&lt;li&gt;Seamless integration with React, leveraging its component-based architecture and state management.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  7. React Awesome Reveal
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fzxcf5pkl4k6mg2kqeiys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fzxcf5pkl4k6mg2kqeiys.png" alt="React Awesome Reveal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-awesome-reveal.morello.dev/" rel="noopener noreferrer"&gt;React Awesome Reveal&lt;/a&gt; offers reveal animations by utilizing the Intersection Observer API to identify when elements are visible within the viewport. Emotion efficiently implements CSS animations for enhanced performance and hardware acceleration.&lt;/p&gt;

&lt;p&gt;React Awesome Reveal has more than 873 &lt;a href="https://github.com/morellodev/react-awesome-reveal" rel="noopener noreferrer"&gt;GitHub stars&lt;/a&gt; and 10,000 weekly &lt;a href="https://www.npmjs.com/package/react-awesome-reveal" rel="noopener noreferrer"&gt;NPM downloads&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Features Of React Awesome Reveal
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Scroll-triggered animations for captivating reveal effects&lt;/li&gt;
&lt;li&gt;Variety of animation options: fades, slides, zooms, rotations, and more&lt;/li&gt;
&lt;li&gt;Customization and control over animation properties&lt;/li&gt;
&lt;li&gt;Sequential animations for cascading or staggered effects&lt;/li&gt;
&lt;li&gt;Integration with Intersection Observer for efficient tracking of component visibility&lt;/li&gt;
&lt;li&gt;Responsive and flexible, suitable for building dynamic websites&lt;/li&gt;
&lt;li&gt;Simple implementation with an easy-to-use API&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I discussed seven great React animation libraries with unique features in this article. I hope my article helped you choose the best React animation library for your project. Thank you for reading🥰.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/" rel="noopener noreferrer"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990" rel="noopener noreferrer"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693" rel="noopener noreferrer"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer" rel="noopener noreferrer"&gt;My LinkedIn&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>css</category>
    </item>
    <item>
      <title>My Journey To 3k+ Followers In 5 Months🥰</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Sun, 28 May 2023 14:00:01 +0000</pubDate>
      <link>https://forem.com/arafat4693/my-journey-to-3k-followers-3oa4</link>
      <guid>https://forem.com/arafat4693/my-journey-to-3k-followers-3oa4</guid>
      <description>&lt;p&gt;Hey there, fellow developers! Today, I want to share my exhilarating journey on Dev.to, where I amassed over &lt;strong&gt;3,000+&lt;/strong&gt; followers within &lt;strong&gt;five months&lt;/strong&gt;. So buckle up and join me as I recount the ups, downs, and strategies that led to this unexpected accomplishment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Early Days: Testing the Waters
&lt;/h2&gt;

&lt;p&gt;When I first dipped my toes into the Dev.to community, I had no idea what awaited me. With passion and a love for sharing knowledge, I began posting articles on various fascinating topics. My initial goal was to connect with like-minded individuals and spark insightful discussions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building a Strong Foundation: Consistency and Quality Content
&lt;/h2&gt;

&lt;p&gt;One of the key factors behind my rapid follower growth was maintaining a consistent presence on the platform. I made it a point to publish new articles regularly, striving to balance quantity and quality. Consistency helped me establish credibility and gave followers something to look forward to.&lt;/p&gt;

&lt;p&gt;However, publishing frequently is only enough if the content is up to par. So I dedicated ample time to research, ensuring that each piece I wrote was well-informed, accurate, and helpful to fellow developers. In addition, I delved into both beginner-friendly and advanced topics, catering to a wide range of audiences and interests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Engaging with the Community: The Power of Interaction
&lt;/h2&gt;

&lt;p&gt;Engagement played a pivotal role in my journey to 3k+ followers. I actively participated in discussions, commenting thoughtfully on other developers' articles and engaging in healthy debates. This interaction helped me forge connections, expand my network, and establish myself as a friendly, approachable community member.&lt;/p&gt;

&lt;p&gt;Additionally, I made it a point to respond promptly to comments on my articles, sparking conversations and fostering a sense of community. Genuine engagement boosted my follower count and allowed me to learn from the diverse perspectives shared by my fellow developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leveraging Social Media: Spreading the Word
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Dev.to&lt;/strong&gt; is an incredible platform, but it's equally important to tap into the power of social media to expand your reach. I leveraged platforms like &lt;strong&gt;Twitter&lt;/strong&gt;, &lt;strong&gt;LinkedIn&lt;/strong&gt;, and &lt;strong&gt;GitHub&lt;/strong&gt; to share my articles, reaching a broader audience beyond the confines of Dev.to. Utilizing relevant hashtags, engaging with other developers, and participating in relevant communities proved invaluable in driving traffic back to my Dev.to profile.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collaborations and Cross-Promotion: Strength in Numbers
&lt;/h2&gt;

&lt;p&gt;Teaming up with other developers for collaborations and cross-promotion can be a game-changer. I contacted individuals with complementary skill sets or shared interests to create joint articles or host virtual events. Collaborations introduced me to new audiences, enabling me to tap into their follower base while offering them exposure to mine. Together, we amplified our impact and fostered a sense of camaraderie within the community.&lt;/p&gt;




&lt;h2&gt;
  
  
  Gratitude and Beyond:
&lt;/h2&gt;

&lt;p&gt;I am grateful for the Dev.to the community, for embracing my ideas, and for joining me on this incredible journey. With your support, I experienced the personal and professional growth I am relishing.&lt;/p&gt;

&lt;p&gt;Reaching 3,000+ followers in five months is not merely a numerical milestone; it symbolizes the connections we've built, the knowledge we've shared, and the collective success we've achieved. I am forever grateful for the invaluable opportunities Dev.to has provided, and I eagerly look forward to continuing this journey with all of you💪.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>learning</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>Flexbox "justify-content" visual representation🔥</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Sun, 28 May 2023 12:22:52 +0000</pubDate>
      <link>https://forem.com/arafat4693/flexbox-justify-content-visual-representation-4c22</link>
      <guid>https://forem.com/arafat4693/flexbox-justify-content-visual-representation-4c22</guid>
      <description>&lt;p&gt;Checkout this beautiful CSS flexbox &lt;code&gt;justify-content&lt;/code&gt; visual representation by &lt;a href="https://www.linkedin.com/feed/update/urn:li:activity:7055894596777598976?utm_source=share&amp;amp;utm_medium=member_desktop"&gt;Mads Brodt&lt;/a&gt;🤯&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkqcitarup5rvwibk8i7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkqcitarup5rvwibk8i7.jpg" alt="Justify Content" width="800" height="1075"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In case you have missed my CSS Flexbox illustration, click &lt;a href="https://dev.to/arafat4693/the-only-css-flexbox-illustration-you-will-ever-need-4nnf"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do Like ❤️ &amp;amp; Share your feedback 🙌&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for your support 💯&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>css</category>
    </item>
    <item>
      <title>🎉Amazing "React Libraries" For Everyone</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Thu, 18 May 2023 19:56:38 +0000</pubDate>
      <link>https://forem.com/arafat4693/top-react-libraries-for-developers-33gb</link>
      <guid>https://forem.com/arafat4693/top-react-libraries-for-developers-33gb</guid>
      <description>&lt;p&gt;In this article, we embark on an exhilarating journey through some of the best React libraries available today. We will explore a selection of libraries that have gained widespread acclaim within the React community, making them invaluable assets in the arsenal of any React developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧭Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;TanStack Query&lt;/li&gt;
&lt;li&gt;DnD Kit&lt;/li&gt;
&lt;li&gt;React Spring&lt;/li&gt;
&lt;li&gt;Atropos&lt;/li&gt;
&lt;li&gt;React Dropzone&lt;/li&gt;
&lt;li&gt;React Tippy&lt;/li&gt;
&lt;li&gt;React Select&lt;/li&gt;
&lt;li&gt;Material UI&lt;/li&gt;
&lt;li&gt;Swiper JS&lt;/li&gt;
&lt;li&gt;React PDF&lt;/li&gt;
&lt;li&gt;React Joyride&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  TanStack Query
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5coqu3jr5ud7jdoiqqvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5coqu3jr5ud7jdoiqqvp.png" alt="react query"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tanstack.com/query/latest" rel="noopener noreferrer"&gt;TANStack&lt;/a&gt; Query is a JavaScript library for managing server state. It efficiently manages states across different components, allowing for a more scalable approach to building web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  DnD Kit
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F58dsno1928t8yjarfpk4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F58dsno1928t8yjarfpk4.gif" alt="DnD Kit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dndkit.com/" rel="noopener noreferrer"&gt;DND Kit&lt;/a&gt; is a React library for building complex drag-and-drop web applications. It provides a set of APIs for handling drag-and-drop interactions, making it easier to build custom drag-and-drop.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Spring
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F7vn6u5ag4ocuvdy9xxrm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F7vn6u5ag4ocuvdy9xxrm.png" alt="React Spring"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.react-spring.dev/" rel="noopener noreferrer"&gt;React Spring&lt;/a&gt; is a library for creating animations and transitions in React app. It provides tools and APIs for animating elements on the web page, making it easier to build engaging user interfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Atropos
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhywois7y4qko68ja592b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhywois7y4qko68ja592b.png" alt="Atropos"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://atroposjs.com/" rel="noopener noreferrer"&gt;Atropos&lt;/a&gt; is a lightweight, accessible, open-source JavaScript library that creates stunning, touch-friendly 3D parallax hover effects. Available for JavaScript, React, Vue.js, and Svelte.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Dropzone
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fot65go5pmos0j71adbew.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fot65go5pmos0j71adbew.gif" alt="React Dropzone"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-dropzone.js.org/" rel="noopener noreferrer"&gt;React Dropzone&lt;/a&gt; is a popular open-source library for creating file upload components in React applications. It provides an easy way to implement drag-and-drop file uploads and supports various customization options.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Tippy
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6m87xfuz86eru615eemo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6m87xfuz86eru615eemo.gif" alt="React Tippy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/react-tippy" rel="noopener noreferrer"&gt;React Tippy&lt;/a&gt; is a well-known npm package that enables tooltips for React applications. Tooltips are tiny information boxes that pop up when the user hovers over or clicks on an item. They are typically used to offer extra context or explanations for UI elements, making the user experience more enjoyable and improving usability.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Select
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F77eeivhglzgd1eqa8zfw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F77eeivhglzgd1eqa8zfw.png" alt="React Select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-select.com/home" rel="noopener noreferrer"&gt;React Select&lt;/a&gt; is designed to replace the native HTML  element, offering a more robust and customizable alternative. It provides various features and options for various use cases, including searching, filtering, multi-select, and asynchronous loading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Material UI
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fx5yzvdncrjokxyczh6cn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fx5yzvdncrjokxyczh6cn.png" alt="Material UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mui.com/" rel="noopener noreferrer"&gt;Material UI&lt;/a&gt; is a popular React component library that provides a set of pre-built UI components. It is highly customizable, with a wide range of theming options and styles that can be easily modified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Swiper JS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fmimx3baswbh1kj6wgqka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fmimx3baswbh1kj6wgqka.png" alt="Swiper JS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://swiperjs.com/" rel="noopener noreferrer"&gt;Swiper.js&lt;/a&gt; is a JS library for creating touch-based, mobile-friendly sliders and carousels for web apps. It provides many features and options for building highly customizable sliders.&lt;/p&gt;

&lt;h2&gt;
  
  
  React PDF
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fh8zll8rmrzubu4e6j4d0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fh8zll8rmrzubu4e6j4d0.png" alt="React PDF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-pdf.org/" rel="noopener noreferrer"&gt;React PDF&lt;/a&gt; is a JS library for generating PDF documents in React apps. It provides a set of React components that can be used to create PDFs, making it easier to generate dynamic and data-driven PDF files.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Joyride
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5c54mpo3im74z5j8c98n.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5c54mpo3im74z5j8c98n.gif" alt="React Joyride"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://react-joyride.com/" rel="noopener noreferrer"&gt;React Joyride&lt;/a&gt; is a JS library for creating guided walkthroughs in React apps. It provides a set of components for creating step-by-step guides that help users understand the features of an app.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As the React ecosystem evolves, staying informed about the latest advancements and incorporating the correct libraries into your projects can significantly impact your development journey. So, dive in, experiment, and leverage the vast potential of React libraries to take your web development skills to new heights. Happy coding!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/" rel="noopener noreferrer"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990" rel="noopener noreferrer"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693" rel="noopener noreferrer"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer" rel="noopener noreferrer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The Only "CSS Selectors" Tutorial You Will Ever Need🔥</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Tue, 16 May 2023 18:28:52 +0000</pubDate>
      <link>https://forem.com/arafat4693/the-only-css-selectors-illustrations-you-will-ever-need-5bja</link>
      <guid>https://forem.com/arafat4693/the-only-css-selectors-illustrations-you-will-ever-need-5bja</guid>
      <description>&lt;p&gt;👉 Being a developer, I understand the significance of CSS selectors. That's why I've crafted a handy cheat sheet to assist you in swiftly finding the perfect selector for your upcoming project.&lt;/p&gt;

&lt;p&gt;👉 This cheat sheet encompasses the most commonly utilized selectors, including class, ID, attribute, descendant, and pseudo-class selectors. Each selector is accompanied by illustrative examples, enabling easy comprehension and application.&lt;/p&gt;

&lt;p&gt;👉 Whether you're a novice or an experienced developer, this cheat sheet will save you valuable time and streamline your coding process.&lt;/p&gt;

&lt;p&gt;👉 Don't hesitate any longer! Explore my "Selectors in CSS" cheat sheet and witness the transformation of your web pages into stunning masterpieces! 💻🎉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31yfz2ikwnw18gnnriez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31yfz2ikwnw18gnnriez.png" alt="descendent" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F792kxb7lwonaxetuzvxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F792kxb7lwonaxetuzvxg.png" alt="direct child" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0jx8e6pqzlqusjieudv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0jx8e6pqzlqusjieudv.png" alt="general sibling" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0zvjulpjekvntobxcn6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0zvjulpjekvntobxcn6.png" alt="adjacent sibling" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7acghnror8d1weqor0ng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7acghnror8d1weqor0ng.png" alt="or" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faw0iasqh2ywici6xmnqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faw0iasqh2ywici6xmnqh.png" alt="and" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zsoh2mb7p88u4n1cm9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zsoh2mb7p88u4n1cm9b.png" alt="has" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8o114vfg2x7xf7y9z9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8o114vfg2x7xf7y9z9c.png" alt="exact" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F51zsweso026nfbr6em2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F51zsweso026nfbr6em2s.png" alt="begins with" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprzeymyftib3rp1tt78c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprzeymyftib3rp1tt78c.png" alt="ends with" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3m6trj1zcte47yivcw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3m6trj1zcte47yivcw2.png" alt="substring" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryztcgz5ohs1bfeaomih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryztcgz5ohs1bfeaomih.png" alt="before" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohbzsjy1677tkx6zp1r6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohbzsjy1677tkx6zp1r6.png" alt="after" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qdm4dqsup6xsvgfu5qf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qdm4dqsup6xsvgfu5qf.png" alt="conclusion" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do Like ❤️ &amp;amp; Share your feedback 🙌&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for your support 💯&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Learn All 24 "CSS Viewport" Units💫</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Tue, 16 May 2023 16:16:31 +0000</pubDate>
      <link>https://forem.com/arafat4693/learn-all-24-css-viewport-units-3cc9</link>
      <guid>https://forem.com/arafat4693/learn-all-24-css-viewport-units-3cc9</guid>
      <description>&lt;p&gt;You've probably heard of the different units used in CSS, but you may not have understood them all — or at least one. This is where I come in. In this post I'll explain all 24 CSS viewport units and their specific uses.&lt;/p&gt;

&lt;p&gt;There are six different viewport units in CSS with three unique modifiers giving us 24 combinations. These viewport units can specify lengths as a proportion of the viewport size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Main four viewport units
&lt;/h2&gt;

&lt;p&gt;The central CSS viewport units are &lt;strong&gt;vw&lt;/strong&gt;, &lt;strong&gt;vh&lt;/strong&gt;, &lt;strong&gt;vmin&lt;/strong&gt;, and &lt;strong&gt;vmax&lt;/strong&gt;. Chances are you know these units as developers widely use them, so I will try to be as brief as possible when explaining them.&lt;/p&gt;

&lt;h3&gt;
  
  
  vw
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;vw&lt;/strong&gt; stands for &lt;strong&gt;viewport width&lt;/strong&gt;. It is a unit of measurement that refers to the width of the viewport, or the visible area of a web page. One &lt;strong&gt;vw&lt;/strong&gt; is equal to 1% of the viewport width.&lt;/p&gt;

&lt;p&gt;For example, if you have a div element with a width of 50vw, this means that the div will be 50% of the width of the viewport. If the viewport is 1000 pixels wide, the div will be 500 pixels wide.&lt;/p&gt;

&lt;p&gt;Here's an example of how you can use vw in CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.my-div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50vw&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;h3&gt;
  
  
  vh
&lt;/h3&gt;

&lt;p&gt;In addition to vw, you can also use &lt;strong&gt;vh&lt;/strong&gt;, which stands for &lt;strong&gt;viewport height&lt;/strong&gt;, to specify sizes based on the height of the viewport. One &lt;strong&gt;vh&lt;/strong&gt; is equal to 1% of the &lt;strong&gt;viewport height&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.my-div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10vh&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;If your viewport height is 300px then this will set the height of the element with the class "my-div" to 30px.&lt;/p&gt;

&lt;h3&gt;
  
  
  vmin and vmax
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;vmin&lt;/strong&gt; stands for &lt;strong&gt;viewport minimum&lt;/strong&gt; and &lt;strong&gt;vmax&lt;/strong&gt; stands for &lt;strong&gt;viewport maximum&lt;/strong&gt;. These are units of measurement that refer to the smaller or larger dimension of the viewport, respectively.&lt;/p&gt;

&lt;p&gt;One &lt;strong&gt;vmin&lt;/strong&gt; is equal to 1% of the smaller dimension of the viewport (either the width or the height, whichever is &lt;strong&gt;smaller&lt;/strong&gt;). One &lt;strong&gt;vmax&lt;/strong&gt; is equal to 1% of the larger dimension of the viewport (either the width or the height, whichever is &lt;strong&gt;larger&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;For example, if you have a div element with a width of 50vmin, this means that the div will be 50% of the &lt;strong&gt;smaller&lt;/strong&gt; dimension of the viewport. If the viewport is 1000 pixels wide and 600 pixels tall, the div will be 300 pixels wide (50% of the &lt;strong&gt;smaller&lt;/strong&gt; dimension, which is the height).&lt;/p&gt;

&lt;p&gt;Here's an example of how you can use vmin in CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.my-div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50vmin&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;Similarly, you can use vmax to specify sizes based on the larger dimension of the viewport.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.my-div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;75vmax&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;This will set the width of the element with the class "my-div" to 75% of the larger dimension of the viewport.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two New Viewport Units in CSS
&lt;/h2&gt;

&lt;p&gt;Apart from the above four units, CSS now defines two other viewport units: &lt;strong&gt;vi&lt;/strong&gt; and &lt;strong&gt;vb&lt;/strong&gt;. The main reason for this change is to make adopting different &lt;strong&gt;writing directions&lt;/strong&gt; in the code easier. For example, your entire application changes direction from horizontal to vertical writing orientation. In that case, the idea of ​​top/bottom or width/height doesn't necessarily mean the same. Because if you want to add padding top and bottom of your text, This will be seen as left and right padding in vertical writing systems rather than top and bottom padding. That's the reason CSS added vi and vb viewport units.&lt;/p&gt;

&lt;h3&gt;
  
  
  vi
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;vi&lt;/code&gt; stands for &lt;strong&gt;Viewport Inline&lt;/strong&gt;, 1% of the viewport’s size in the inline direction. &lt;strong&gt;vi&lt;/strong&gt; represents the inline direction of your document. A horizontal writing direction corresponds with the &lt;strong&gt;width&lt;/strong&gt; of your viewport, and a vertical writing direction represents the height of your viewport. The easy way to remember the approach is that it is in the same direction as your text.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.horizontal__direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;writing-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;horizontal-tb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="n"&gt;vi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Equals to 30vw */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.vertical__direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;writing-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;vertical-lr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="n"&gt;vi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Equals to 30vh */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  vb
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;vb&lt;/code&gt; is the opposite of vi and stands for &lt;strong&gt;Viewport Block&lt;/strong&gt;, 1% of the viewport’s size in the &lt;strong&gt;block direction&lt;/strong&gt;. In a horizontal writing direction, vi will correspond with the viewport height, and in a vertical document, this will represent the width of your viewport. An easy to remember this unit is to remember that the block direction will always be the direction block elements (two divs) stack on top of one another.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.horizontal__direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;writing-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;horizontal-tb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="n"&gt;vb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Equals to 30vh */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.vertical__direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;writing-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;vertical-lr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="n"&gt;vb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Equals to 30vw */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Viewport Unit Modifiers
&lt;/h2&gt;

&lt;p&gt;Till now, I have explained the six main types of viewport units, but you can add three different &lt;strong&gt;modifiers&lt;/strong&gt; to these units to make them behave differently when your viewport is &lt;strong&gt;resizable&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;These modifiers are &lt;strong&gt;s&lt;/strong&gt;, &lt;strong&gt;l&lt;/strong&gt;, and &lt;strong&gt;d&lt;/strong&gt;. To use a modifier, you have to put the modifier &lt;strong&gt;after&lt;/strong&gt; the &lt;strong&gt;number&lt;/strong&gt; and &lt;strong&gt;before&lt;/strong&gt; the &lt;strong&gt;unit&lt;/strong&gt;, eg 10svw, giving us a total of four combinations for each of the six viewport units. vh, svh, lvh, and dvh.&lt;/p&gt;

&lt;p&gt;If you don't use a unit modifier, such as 10vw or 10vh, the browser automatically defaults to one of the three modifiers depending on the browser implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;s&lt;/code&gt; modifier
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;s&lt;/code&gt; modifier stands for Small and represents the smallest possible viewport. For example, when you browse the web on your phone, you may notice that the header part, where the URL and menu option lies, disappears when you scroll down. This happens because your viewport technically changed size since the header is no longer taking up part of your viewport. &lt;br&gt;
For example, setting an element to &lt;strong&gt;100svh&lt;/strong&gt; would take up &lt;strong&gt;100%&lt;/strong&gt; of the screen's height based on the &lt;strong&gt;screen's size&lt;/strong&gt; when the header is shown. It does not matter if the header is visible or not. This unit will always base its size on what the viewport would be if the header is showing.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;l&lt;/code&gt; modifier
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;l&lt;/code&gt; modifier stands for Large and represents the largest possible viewport. You can think of &lt;code&gt;l&lt;/code&gt; modifier as the opposite of the &lt;code&gt;s&lt;/code&gt; modifier. In our mobile phone example this would be the size of the viewport when the header is &lt;strong&gt;NOT&lt;/strong&gt; shown. For example, setting an element to &lt;strong&gt;100lvh&lt;/strong&gt; would take up 100% of the screen's height based on the screen's size when the header is &lt;strong&gt;not&lt;/strong&gt; shown.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;d&lt;/code&gt; modifier
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;d&lt;/code&gt; modifier stands for Dynamic and represents the current viewport size, precisely like a mixer of the &lt;code&gt;s&lt;/code&gt; and &lt;code&gt;l&lt;/code&gt; modifiers. In our mobile phone example, this would always be the size of the current viewport, no matter if the header is showing or not. If our URL bar is showing, then the d modifier is the same size as the &lt;code&gt;s&lt;/code&gt; modifier, and if the header is NOT showing, the d modifier is the same size as the &lt;code&gt;l&lt;/code&gt; modifier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You might find these 24 units confusing and a lot, but it is just six units with three relatively simple modifiers. And most of the time, you will always use the first four units that I have explained(&lt;code&gt;vw&lt;/code&gt;, &lt;code&gt;vh&lt;/code&gt;, &lt;code&gt;vmin&lt;/code&gt;, &lt;code&gt;vmax&lt;/code&gt;). And the rest of the units are still in the draft stage, which means they still need to be officially.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The Only CSS Flexbox Illustration You Will Ever Need</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Thu, 11 May 2023 21:16:26 +0000</pubDate>
      <link>https://forem.com/arafat4693/the-only-css-flexbox-illustration-you-will-ever-need-4nnf</link>
      <guid>https://forem.com/arafat4693/the-only-css-flexbox-illustration-you-will-ever-need-4nnf</guid>
      <description>&lt;p&gt;I created this CSS flexbox visual representation🤯&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fbzeazftingrcs719xdd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fbzeazftingrcs719xdd9.png" alt="css flexbox"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do Like ❤️ &amp;amp; Share your feedback 🙌&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/" rel="noopener noreferrer"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990" rel="noopener noreferrer"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693" rel="noopener noreferrer"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer" rel="noopener noreferrer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for your support 💯&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Master "Generics" In Typescript🎉</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Thu, 11 May 2023 09:44:43 +0000</pubDate>
      <link>https://forem.com/arafat4693/master-generics-in-typescript-16ji</link>
      <guid>https://forem.com/arafat4693/master-generics-in-typescript-16ji</guid>
      <description>&lt;p&gt;Generics in Typescript allows you to create a component that can work with different types. This lets users use these components with their specific type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Before reading this article, please read my article about TS &lt;a href="https://dev.to/arafat4693/typescript-utility-types-that-you-must-know-4m6k"&gt;utility types&lt;/a&gt; as It will help you to understand this article better.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1. Generics with type&lt;/li&gt;
&lt;li&gt;2. Generic functions&lt;/li&gt;
&lt;li&gt;3. Generics with built-in functions&lt;/li&gt;
&lt;li&gt;4. Inferring the types&lt;/li&gt;
&lt;li&gt;5. Constraints on type arguments&lt;/li&gt;
&lt;li&gt;6. Constraints in functions&lt;/li&gt;
&lt;li&gt;7. Use &lt;code&gt;as&lt;/code&gt; when necessary&lt;/li&gt;
&lt;li&gt;8. Multiple generics&lt;/li&gt;
&lt;li&gt;9. Defaults in type arguments&lt;/li&gt;
&lt;li&gt;10. Class Types in Generics&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Here are few possible ways to use &lt;code&gt;Generics&lt;/code&gt; in Typescript:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. Generics with type
&lt;/h2&gt;

&lt;p&gt;The easiest way of using &lt;code&gt;generics&lt;/code&gt; is with &lt;code&gt;type.&lt;/code&gt; For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;MyData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&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="nx"&gt;Type&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;DataAsString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;MyData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// type DataAsString = {&lt;/span&gt;
&lt;span class="c1"&gt;//    data: string;&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we passed &lt;code&gt;string&lt;/code&gt; as a type parameter, our data will be &lt;code&gt;string&lt;/code&gt; type. Likewise, if we pass the &lt;code&gt;number&lt;/code&gt; type, our data will be of number type. And that's the beauty of &lt;code&gt;generics.&lt;/code&gt; You can work with any type.&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;MyData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&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="nx"&gt;Type&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;DataAsString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;MyData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// type DataAsString = {&lt;/span&gt;
&lt;span class="c1"&gt;//    data: number;&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Generic functions
&lt;/h2&gt;

&lt;p&gt;As you can pass arguments to a function, you can also pass &lt;code&gt;type arguments&lt;/code&gt; to a function. 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;const&lt;/span&gt; &lt;span class="nx"&gt;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&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;url&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;fetchData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&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;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/books&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="c1"&gt;// res: {name: string, age: number}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We passed &lt;code&gt;{name: string, age: number}&lt;/code&gt; as a &lt;code&gt;type argument&lt;/code&gt; to the &lt;code&gt;fetchData&lt;/code&gt; function, And this type argument tells &lt;code&gt;res&lt;/code&gt; what It is supposed to be because this is what's getting typed in &lt;code&gt;Promise&amp;lt;Type&amp;gt;.&lt;/code&gt; So now the function &lt;code&gt;fetchData&lt;/code&gt; has become a generic function. A generic function is just a normal function but includes a type argument.&lt;/p&gt;

&lt;p&gt;If we want to pass another type, our &lt;code&gt;res&lt;/code&gt; will replicate that same type.&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;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&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;url&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;fetchData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&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="o"&gt;&amp;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;/api/books&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="c1"&gt;// res: {id: number, email: string}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Generics with built-in functions
&lt;/h2&gt;

&lt;p&gt;You can even use generics with built-in functions. For example, you can create a &lt;code&gt;Set&lt;/code&gt; that stores only numbers by using the Set constructor with a type parameter:&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;numberSet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&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;numberSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&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="nx"&gt;numberSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;numberSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you can create a &lt;code&gt;Map&lt;/code&gt; that maps strings to numbers by using the Map constructor with type parameters for the key and value types:&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;stringToNumberMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;number&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;stringToNumberMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;one&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;stringToNumberMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;two&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;stringToNumberMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Inferring the types
&lt;/h2&gt;

&lt;p&gt;If your &lt;code&gt;type argument&lt;/code&gt; looks similar to your &lt;code&gt;runtime argument&lt;/code&gt; then you don't have to pass a &lt;code&gt;generic type&lt;/code&gt; to your function. 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;function&lt;/span&gt; &lt;span class="nf"&gt;identity&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;identity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// const result1: number&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;identity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;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;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// const result2: string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While the above example looks correct, we can simplify it more:&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;function&lt;/span&gt; &lt;span class="nf"&gt;identity&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// const result1: number&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// const result2: string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, because we are not passing any &lt;code&gt;type argument&lt;/code&gt;, then &lt;code&gt;Typescript&lt;/code&gt; will look in the &lt;code&gt;runtime argument&lt;/code&gt; to see If It can &lt;code&gt;infer&lt;/code&gt; anything from it.&lt;br&gt;
So the return type is &lt;code&gt;inferred&lt;/code&gt; from the runtime argument type, and the function returns the same type as it receives.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Constraints on type arguments
&lt;/h2&gt;

&lt;p&gt;In our following example, we wanted to be able to use the &lt;code&gt;ReturnType&lt;/code&gt; utility type, but the compiler could not prove that every type was a function; it could be a string or number, and as we know, that &lt;code&gt;ReturnType&lt;/code&gt; works only with functions, so it warns us that we can’t make this assumption.&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;GetPromiseData&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;Awaited&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;ReturnType&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;&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;// Error: Type 'T' does not satisfy the constraint '(...args: any) =&amp;gt; any'&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;PromiseResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;GetPromiseData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
  &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;id&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;email&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So to make It clear to Tyepscript, We have to say that &lt;code&gt;T&lt;/code&gt; is only a function, and we can do this by adding &lt;code&gt;extends (...args: any) =&amp;gt; any&lt;/code&gt; after the &lt;code&gt;T&lt;/code&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;type&lt;/span&gt; &lt;span class="nx"&gt;GetPromiseData&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="nf"&gt;extends &lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kr"&gt;any&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;Awaited&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;ReturnType&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;&amp;gt;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;PromiseResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;GetPromiseData&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
  &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;id&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;email&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Constraints in functions
&lt;/h2&gt;

&lt;p&gt;In our following example, we wanted to access the &lt;code&gt;.address&lt;/code&gt; property of arg, but the compiler could not prove that every type has a &lt;code&gt;.address&lt;/code&gt; property, so it warned us that we couldn’t make this assumption.&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;function&lt;/span&gt; &lt;span class="nf"&gt;myFunc&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&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;arg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Type&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="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Property 'address' does not exist on type 'Type'.&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;arg&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;To fix this error, we can create an interface with &lt;code&gt;address&lt;/code&gt; property in it and extend it with the &lt;code&gt;Type&lt;/code&gt; argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IDetails&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;myFunc&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;IDetails&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;arg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Type&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="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Now we know it has a .address property, so no more error&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;arg&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;Because the generic function is now constrained, it will no longer work over all types:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;myFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// error: Argument of type 'boolean' is not assignable to parameter of type 'IDetails'.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, we need to pass in values whose type has &lt;code&gt;address&lt;/code&gt; property:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;myFunc&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Something&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;h2&gt;
  
  
  7. Use &lt;code&gt;as&lt;/code&gt; when necessary
&lt;/h2&gt;

&lt;p&gt;Sometimes using &lt;code&gt;as&lt;/code&gt; is the best thing you can do when using generics. 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;const&lt;/span&gt; &lt;span class="nx"&gt;ObjectKeys&lt;/span&gt; &lt;span class="o"&gt;=&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="kd"&gt;extends&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;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;keyof&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;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Error: Type 'string[]' is not assignable to type '(keyof T)[]'. &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ObjectKeys&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;me@gmail.com&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;Here we are getting an error because the &lt;code&gt;Object.keys&lt;/code&gt; method returns an array of string values, and TypeScript cannot guarantee that the string values returned by &lt;code&gt;Object.keys&lt;/code&gt; actually correspond to valid keys of the generic type &lt;code&gt;T.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To fix this error, we can explicitly typecast the &lt;code&gt;Object.keys&lt;/code&gt; result to an array of keyof &lt;code&gt;T&lt;/code&gt; using the &lt;code&gt;as&lt;/code&gt; keyword:&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;ObjectKeys&lt;/span&gt; &lt;span class="o"&gt;=&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="kd"&gt;extends&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;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&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="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;keyof&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="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ObjectKeys&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;me@gmail.com&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;h2&gt;
  
  
  8. Multiple generics
&lt;/h2&gt;

&lt;p&gt;Sometimes we have to use multiple generics to make sure that we are getting back a certain type. Consider the following 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;function&lt;/span&gt; &lt;span class="nf"&gt;getProperty&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&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="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;obj&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&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="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;getProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// return type: string | number | boolean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While the above example is correct, the problem is that the return type is not explicit. Return type is an &lt;code&gt;union&lt;/code&gt; consisting of 3 different types. To fix this problem, we can use multiple generic types:&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;function&lt;/span&gt; &lt;span class="nf"&gt;getProperty&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="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Key&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="kr"&gt;keyof&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&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="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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;obj&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&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="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;getProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// return type: number&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we've added generic type parameter &lt;code&gt;Key&lt;/code&gt; to represent the key type of the object &lt;code&gt;T&lt;/code&gt;. So now we will get a specific return type only.&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;function&lt;/span&gt; &lt;span class="nf"&gt;getProperty&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="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Key&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="kr"&gt;keyof&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&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="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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;obj&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&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="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;getProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// return type: boolean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. Defaults in type arguments
&lt;/h2&gt;

&lt;p&gt;We can also use default types in generics. Consider the following 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;makeSet&lt;/span&gt; &lt;span class="o"&gt;=&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="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="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&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="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mySet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;makeSet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// const mySet: Set&amp;lt;unknown&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we are getting &lt;code&gt;unknown&lt;/code&gt; because we didn't pass any type argument to &lt;code&gt;makeSet&lt;/code&gt; function. We can solve this problem by either passing a type argument like this, &lt;code&gt;makeSet&amp;lt;number&amp;gt;()&lt;/code&gt; or by specifying a default type:&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;makeSet&lt;/span&gt; &lt;span class="o"&gt;=&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;=&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&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="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&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="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mySet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;makeSet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// const mySet: Set&amp;lt;number&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  10. Class Types in Generics
&lt;/h2&gt;

&lt;p&gt;We can also refer to class types by their constructor functions. 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;function&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Type&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;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;new &lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt; &lt;span class="p"&gt;}):&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;c&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;Here's a breakdown of how the function works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;create&lt;/code&gt; function is declared with a type parameter &lt;code&gt;Type&lt;/code&gt;, representing the type the function will make.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The function takes a single argument &lt;code&gt;c&lt;/code&gt;, an object representing a constructor function for the type &lt;code&gt;Type&lt;/code&gt;. The argument has the type &lt;code&gt;{ new (): Type }&lt;/code&gt;, an object type specifying a constructor function that takes no arguments and returns a value of type &lt;code&gt;Type&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;new&lt;/code&gt; keyword is used to create a new instance of the type &lt;code&gt;Type&lt;/code&gt; inside the function by calling the constructor function passed as the argument &lt;code&gt;c&lt;/code&gt;. The &lt;code&gt;new&lt;/code&gt; keyword creates a further object of the type &lt;code&gt;Type&lt;/code&gt; and returns it as the result of the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The function's return type is specified as &lt;code&gt;Type&lt;/code&gt;, which ensures that the function returns an instance of the type specified by the type parameter.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of how the &lt;code&gt;create&lt;/code&gt; function can be used:&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;class&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nx"&gt;value&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;instance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MyClass&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="nx"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example defines a simple class, &lt;code&gt;MyClass,&lt;/code&gt; with a single property value. We then call the &lt;code&gt;create&lt;/code&gt; function, passing the &lt;code&gt;MyClass&lt;/code&gt; constructor function as the argument. The &lt;code&gt;create&lt;/code&gt; function creates a new instance of &lt;code&gt;MyClass&lt;/code&gt; using the constructor function and returns it as an instance of type &lt;code&gt;MyClass.&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, TypeScript's support for generics provides a powerful tool for writing type-safe and reusable code. By defining generic types and functions, you can create code that works with various types while maintaining strict type-checking.&lt;/p&gt;

&lt;p&gt;To make the best use of generics in TypeScript, it's essential to understand how to define and use generic types, specify constraints on generic type parameters, and use type inference to reduce the need for explicit type annotations. Additionally, it's crucial to use generics to maintain good code readability and avoid unnecessary complexity.&lt;/p&gt;

&lt;p&gt;When appropriately used, generics can significantly improve the quality and maintainability of your TypeScript code. By taking advantage of TypeScript's powerful type system and the flexibility of generic types, you can create highly reusable and expressive code while still maintaining the strong type safety that TypeScript provides.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>🔥Hot CSS Tools For Everyone</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Tue, 09 May 2023 14:11:18 +0000</pubDate>
      <link>https://forem.com/arafat4693/hot-css-tools-for-everyone-1b8o</link>
      <guid>https://forem.com/arafat4693/hot-css-tools-for-everyone-1b8o</guid>
      <description>&lt;p&gt;As a web developer, keeping up with the latest tools and technologies can be challenging. However, with CSS being a fundamental part of front-end web development, having access to the right CSS tools can make a significant difference in the productivity and creativity of a developer. &lt;/p&gt;

&lt;p&gt;Whether you are a beginner or an experienced developer, there are always new and exciting CSS tools and libraries to explore that can help you streamline your workflow and create stunning designs.&lt;/p&gt;

&lt;p&gt;In this article, we will look at some of the hottest CSS tools available to developers today, including frameworks, libraries, and utilities, to help you stay ahead of the curve and take your CSS skills to the next level.&lt;/p&gt;

&lt;h2&gt;
  
  
  🕔Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Neumorphism&lt;/li&gt;
&lt;li&gt;Animista&lt;/li&gt;
&lt;li&gt;Animated Background&lt;/li&gt;
&lt;li&gt;Spin Kit&lt;/li&gt;
&lt;li&gt;Flexplorer&lt;/li&gt;
&lt;li&gt;Grid Generator&lt;/li&gt;
&lt;li&gt;Layout Generator&lt;/li&gt;
&lt;li&gt;Shaddows Brumm&lt;/li&gt;
&lt;li&gt;Glassmorphism&lt;/li&gt;
&lt;li&gt;Cubic-Bezier&lt;/li&gt;
&lt;li&gt;Haikei&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Neumorphism
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fbq2thuhy5zjj7e0x9vd5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fbq2thuhy5zjj7e0x9vd5.gif" alt="neumorphism"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://neumorphism.io/#e0e0e0" rel="noopener noreferrer"&gt;Neumorphism.io&lt;/a&gt; is a website that showcases the neumorphism design trend, also known as soft UI or neo-skeuomorphism. It generates soft-UI CSS styles using shadows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Animista
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fvmebc0j5325d0j2fty6f.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fvmebc0j5325d0j2fty6f.gif" alt="animista"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://animista.net/play" rel="noopener noreferrer"&gt;Animista&lt;/a&gt; is a website that provides a collection of CSS animations and animation presets that can be easily customized and applied to web elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Animated Background
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F40zrw4h65o0bulpiisxb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F40zrw4h65o0bulpiisxb.gif" alt="animated bg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://wweb.dev/resources/animated-css-background-generator" rel="noopener noreferrer"&gt;Wweb.dev&lt;/a&gt; offers an Animated CSS Background Generator, which allows users to create and customize animated backgrounds for their web projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spin Kit
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fbycdqun2txu3rlh0wn9q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fbycdqun2txu3rlh0wn9q.gif" alt="spin kit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tobiasahlin.com/spinkit/" rel="noopener noreferrer"&gt;Spin Kit&lt;/a&gt; is a collection of CSS loading animations created by Tobias Ahlin. It offers a range of simple, lightweight, and customizable spinners that can be easily integrated into web projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flexplorer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F21rjhmo374d3061bpxvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F21rjhmo374d3061bpxvz.png" alt="Flexplorer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bennettfeely.com/flexplorer/" rel="noopener noreferrer"&gt;Flexplorer&lt;/a&gt; is an online tool by web developer Bennett Feely that helps developers learn and experiment with CSS flexbox layouts. Flexbox lets you build flexible and responsive layouts quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grid Generator
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fopxdcavjvdrtb8ireqo1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fopxdcavjvdrtb8ireqo1.png" alt="grid generator"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cssgrid-generator.netlify.app/" rel="noopener noreferrer"&gt;CSS Grid Generator&lt;/a&gt; is a web-based tool that helps developers create complex grid layouts using CSS Grid. Grid layouts are a powerful way to create flexible and responsive designs for web pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout Generator
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6g48ug0ko7jc5cmq46yb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6g48ug0ko7jc5cmq46yb.png" alt="layout generator"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://layout.bradwoods.io/" rel="noopener noreferrer"&gt;CSS Layout Generator&lt;/a&gt; is a web-based tool that allows developers to create and experiment with CSS layout styles. It provides a visual interface for designing and customizing layout components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shaddows Brumm
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4jfzkdrcd55qwrvnlgwf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4jfzkdrcd55qwrvnlgwf.gif" alt="shadow brumm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shadows.brumm.af/" rel="noopener noreferrer"&gt;Shadows Brumm&lt;/a&gt; is a web-based tool for generating CSS box-shadow effects. It provides an easy-to-use interface that allows users to create complex and visually appealing box-shadow effects using a variety of parameters and options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Glassmorphism
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fuuv79pojl21jvfi33ibt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fuuv79pojl21jvfi33ibt.gif" alt="Glassmorphism"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hype4.academy/tools/glassmorphism-generator" rel="noopener noreferrer"&gt;Glassmorphism&lt;/a&gt; is a design trend that uses transparent and blurred glass-like backgrounds to create a modern, sleek look for user interfaces. The Glassmorphism Generator is a web-based tool for creating Glassmorphism-inspired designs and graphics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cubic-Bezier
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5dkr8bil3tc1hejexyfm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5dkr8bil3tc1hejexyfm.gif" alt="Cubic-Bezier"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cubic-bezier.com/#.17,.67,.83,.67" rel="noopener noreferrer"&gt;Cubic-Bezier&lt;/a&gt; is a web-based tool that allows users to create custom easing curves, animation and transition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Haikei
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F7wxmco9jsc166nxe1323.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F7wxmco9jsc166nxe1323.gif" alt="Haikei"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://app.haikei.app/" rel="noopener noreferrer"&gt;Haikei&lt;/a&gt; is a web-based tool for creating customizable and scalable vector graphics for use in web design, illustrations, and other graphic design projects. The app allows users to create unique designs by combining and modifying various shapes, colors, and patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, CSS tools are essential for developers who want to create visually stunning and responsive websites. In addition, the proper set of tools can significantly improve productivity, allowing developers to save time and focus on more critical aspects of their projects. &lt;/p&gt;

&lt;p&gt;I hope this article has provided valuable insights into some of the hottest CSS tools available today and will help you enhance your development skills and create exceptional user experiences for your audience. Remember to experiment and find what works best for you, as the right CSS tools can help you take your projects to the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app" rel="noopener noreferrer"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990" rel="noopener noreferrer"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693" rel="noopener noreferrer"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer" rel="noopener noreferrer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>css</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Learn "Zod" In 5 Minutes</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Fri, 28 Apr 2023 21:22:12 +0000</pubDate>
      <link>https://forem.com/arafat4693/learn-zod-in-5-minutes-17pn</link>
      <guid>https://forem.com/arafat4693/learn-zod-in-5-minutes-17pn</guid>
      <description>&lt;h2&gt;
  
  
  Goals of Zod
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Validation library (Schema first)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First class&lt;/strong&gt; &lt;strong&gt;typescript&lt;/strong&gt; support (No need to write types twice)&lt;/li&gt;
&lt;li&gt;Immutable (Functional programming)&lt;/li&gt;
&lt;li&gt;Super small library (8kb)&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Can be used with Node/Deno/Bun/Any Browser etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;npm i zod&lt;/code&gt;&lt;br&gt;
&lt;code&gt;import { z } from "zod";&lt;/code&gt;&lt;br&gt;
Must have &lt;code&gt;strict: true&lt;/code&gt; in tsconfig file&lt;/p&gt;


&lt;h2&gt;
  
  
  Basic Usage
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// creating a schema&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UserSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// extract the inferred type&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// { username: string }&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arafat&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// parsing&lt;/span&gt;
&lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; {username: "Arafat"}&lt;/span&gt;
&lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; throws ZodError&lt;/span&gt;

&lt;span class="c1"&gt;// "safe" parsing (doesn't throw error if validation fails)&lt;/span&gt;
&lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// =&amp;gt; { success: true; data: {username: "Arafat"} }&lt;/span&gt;

&lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// =&amp;gt; { success: false; error: ZodError }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic Types
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// primitive values&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// empty types&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;null&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// accepts undefined&lt;/span&gt;

&lt;span class="c1"&gt;// catch-all types&lt;/span&gt;
&lt;span class="c1"&gt;// allows any value&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// never type&lt;/span&gt;
&lt;span class="c1"&gt;// allows no values&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;never&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Validations
&lt;/h2&gt;

&lt;p&gt;All types in &lt;strong&gt;Zod&lt;/strong&gt; have an optional &lt;strong&gt;options&lt;/strong&gt; parameter you can pass as the last param which defines things like error messages.&lt;/p&gt;

&lt;p&gt;Also many types has validations you can chain onto the end of the type like optional&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z.string().optional()&lt;/code&gt;&lt;br&gt;
&lt;code&gt;z.number().lt(5)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;optional()&lt;/code&gt; - Makes field optional&lt;br&gt;
&lt;code&gt;nullable&lt;/code&gt; - Makes field also able to be &lt;code&gt;null&lt;/code&gt;&lt;br&gt;
&lt;code&gt;nullish&lt;/code&gt; - Makes field able to be &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Some of the handful string-specific validations&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;cuid&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;startsWith&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="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;endsWith&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="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// trim whitespace&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// defaults to UTC, see below for options&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Some of the handful number-specific validations&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;gte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// alias .min(5)&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;lte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// alias .max(5)&lt;/span&gt;

&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// value must be an integer&lt;/span&gt;

&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;positive&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//     &amp;gt; 0&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;nonnegative&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//  &amp;gt;= 0&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;negative&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//     &amp;lt; 0&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;nonpositive&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//  &amp;lt;= 0&lt;/span&gt;

&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;multipleOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Evenly divisible by 5. Alias .step(5)&lt;/span&gt;

&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;finite&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// value must be finite, not Infinity or -Infinity&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Default Values
&lt;/h2&gt;

&lt;p&gt;Can take a value or function.&lt;br&gt;
Only returns a &lt;strong&gt;default&lt;/strong&gt; when input is &lt;strong&gt;undefined&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z.string().default("Arafat")&lt;/code&gt;&lt;br&gt;
&lt;code&gt;z.string().default(Math.random)&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Literals
&lt;/h2&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;one&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;one&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// retrieve literal value&lt;/span&gt;
&lt;span class="nx"&gt;one&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "one"&lt;/span&gt;

&lt;span class="c1"&gt;// Currently there is no support for Date literals in Zod.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Enums
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  Zod Enums
&lt;/h3&gt;


&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;FishEnum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Salmon&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;Tuna&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;Trout&lt;/span&gt;&lt;span class="dl"&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;FishEnum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;FishEnum&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 'Salmon' | 'Tuna' | 'Trout'&lt;/span&gt;

&lt;span class="c1"&gt;// Doesn't work without `as const` since it has to be read only&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;VALUES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Salmon&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;Tuna&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;Trout&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fishEnum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;VALUES&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;fishEnum&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kr"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Salmon&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; autocompletes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;
  
  
  TS Enums: (You should use Zod enums when possible)
&lt;/h3&gt;


&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;enum&lt;/span&gt; &lt;span class="nx"&gt;Fruits&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;Apple&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;Banana&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;FruitEnum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nativeEnum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Objects
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;z.object({})&lt;/code&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="c1"&gt;// all properties are required by default&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// extract the inferred type like this&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// equivalent to:&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&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;code&gt;.shape.key&lt;/code&gt; - Gets schema of that key&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; string schema&lt;/span&gt;
&lt;span class="nx"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; number schema&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.extend&lt;/code&gt; - Add new fields to schema&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;DogWithBreed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;breed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.merge&lt;/code&gt; - Combine two object schemas&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;BaseTeacher&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;students&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&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;const&lt;/span&gt; &lt;span class="nx"&gt;HasID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&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;const&lt;/span&gt; &lt;span class="nx"&gt;Teacher&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;BaseTeacher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HasID&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;Teacher&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;Teacher&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; { students: string[], id: string }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.pick/.omit/.partial&lt;/code&gt; - Same as TS&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;Recipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;


&lt;span class="c1"&gt;// To only keep certain keys, use .pick&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;JustTheName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pick&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;JustTheName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;JustTheName&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; { name: string }&lt;/span&gt;


&lt;span class="c1"&gt;// To remove certain keys, use .omit&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;NoIDRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;omit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;NoIDRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;NoIDRecipe&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; { name: string, ingredients: string[] }&lt;/span&gt;


&lt;span class="c1"&gt;// To make every key optional, use .partial&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;partialRecipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;partial&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// { id?: string | undefined; name?: string | undefined; ingredients?: string[] | undefined }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.deepPartial&lt;/code&gt; - Same as partial but for nested objects&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;latitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;longitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="na"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;deepPartialUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deepPartial&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="cm"&gt;/*
{
  username?: string | undefined,
  location?: {
    latitude?: number | undefined;
    longitude?: number | undefined;
  } | undefined,
  strings?: { value?: string}[]
}
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;passThrough&lt;/code&gt; - Let through non-defined fields&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;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bob dylan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;extraKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; { name: "bob dylan" }&lt;/span&gt;
&lt;span class="c1"&gt;// extraKey has been stripped&lt;/span&gt;


&lt;span class="c1"&gt;// Instead, if you want to pass through unknown keys, use .passthrough()&lt;/span&gt;
&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;passthrough&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bob dylan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;extraKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; { name: "bob dylan", extraKey: 61 }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.strict&lt;/code&gt; - Fail for non-defined fields&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;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&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="nf"&gt;strict&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bob dylan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;extraKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; throws ZodError&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Arrays
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;const stringArray = z.array(z.string());&lt;/code&gt; - Array of strings&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.element&lt;/code&gt; - Get schema of array element&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;stringArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; string schema&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.nonempty&lt;/code&gt; - Ensure array has a value&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;nonEmptyStrings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;nonempty&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// the inferred type is now&lt;/span&gt;
&lt;span class="c1"&gt;// [string, ...string[]]&lt;/span&gt;

&lt;span class="nx"&gt;nonEmptyStrings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt; &lt;span class="c1"&gt;// throws: "Array cannot be empty"&lt;/span&gt;
&lt;span class="nx"&gt;nonEmptyStrings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ariana Grande&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt; &lt;span class="c1"&gt;// passes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.min/.max/.length&lt;/code&gt; - Gurantee certail size&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// must contain 5 or more items&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// must contain 5 or fewer items&lt;/span&gt;
&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// must contain 5 items exactly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Advanced Types
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  Tuple
&lt;/h3&gt;

&lt;p&gt;Fixed length array with specific values for each index in the array&lt;/p&gt;

&lt;p&gt;Think for example an array of coordinates.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z.tuple([z.number(), z.number(), z.number().optional()])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.rest&lt;/code&gt; - Allow infinite number of additional elements of specific type&lt;/p&gt;


&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;variadicTuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tuple&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()]).&lt;/span&gt;&lt;span class="nf"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;variadicTuple&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; [string, ...number[]];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;h3&gt;
  
  
  Union
&lt;/h3&gt;

&lt;p&gt;Can be combined with things like arrays to make very powerful type checking. &lt;/p&gt;


&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stringOrNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;union&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;()]);&lt;/span&gt;
&lt;span class="c1"&gt;// same as&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stringOrNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="nx"&gt;stringOrNumber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// passes&lt;/span&gt;
&lt;span class="nx"&gt;stringOrNumber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// passes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;blockquote&gt;
&lt;h4&gt;
  
  
  Discriminated unions
&lt;/h4&gt;

&lt;p&gt;Used when one key is shared between many types.&lt;/p&gt;

&lt;p&gt;Useful with things like statuses.&lt;/p&gt;

&lt;p&gt;Helps Zod be more performant in its checks and provides better error messages&lt;/p&gt;


&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myUnion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;discriminatedUnion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;status&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;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;(&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="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;failed&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;instanceof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Error&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="nx"&gt;myUnion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&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="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yippie ki yay&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;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Records
&lt;/h2&gt;

&lt;p&gt;Useful when you don't know the exact keys and only care about the values&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z.record(z.number())&lt;/code&gt; - Will gurantee that all the values are numbers&lt;/p&gt;

&lt;p&gt;&lt;code&gt;z.record(z.string(), z.object({ name: z.string() }))&lt;/code&gt; - Validates the keys match the pattern and values match the pattern. Good for things like stores, maps and caches.&lt;/p&gt;




&lt;h2&gt;
  
  
  Maps
&lt;/h2&gt;

&lt;p&gt;Usually want to use this instead of key version of record&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;stringNumberMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&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;StringNumberMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;stringNumberMap&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// type StringNumberMap = Map&amp;lt;string, number&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Sets
&lt;/h2&gt;

&lt;p&gt;Works just like arrays (Only unique values are accepted in a set)&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;numberSet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&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;NumberSet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;numberSet&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// type NumberSet = Set&amp;lt;number&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Promises
&lt;/h2&gt;

&lt;p&gt;Does validation in two steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ensures object is promise&lt;/li&gt;
&lt;li&gt;Hooks up &lt;code&gt;.then&lt;/code&gt; listener to the promise to validate return type.
&lt;/li&gt;
&lt;/ol&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;numberPromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="nx"&gt;numberPromise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tuna&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// ZodError: Non-Promise type: string&lt;/span&gt;

&lt;span class="nx"&gt;numberPromise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tuna&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; Promise&amp;lt;number&amp;gt;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;numberPromise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tuna&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="c1"&gt;// ZodError: Non-number type: string&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;numberPromise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;3.14&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="c1"&gt;// =&amp;gt; 3.14&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Advanced Validation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.refine&lt;/code&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;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;refine&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;val&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;val&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@gmail.com&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;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Email must end with @gmail.com&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;Also you can use the &lt;code&gt;superRefine&lt;/code&gt; method to get low level on custom validation, but most likely won't need it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling Errors
&lt;/h3&gt;

&lt;p&gt;Errors are extremely detailed in Zod and not really human readable out of the box. To get around this you can either have custorm error messages for all your validations, or you can use a library like &lt;code&gt;zod-validation-error&lt;/code&gt; which adds a simple &lt;code&gt;fromZodError&lt;/code&gt; method to make error human readable.&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;fromZodError&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod-validation-error&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="nf"&gt;fromZodError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are many more concepts of Zod, and I can't explain all that stuff here. However, If you want to discover them, head to &lt;a href="https://zod.dev/?id=error-handling"&gt;Zod's official documentation&lt;/a&gt;. They've explained everything perfectly there. &lt;/p&gt;

&lt;p&gt;So, this was it, guys. I hope you guys will like this crash course. I've tried my best to pick all of the essential concepts of Zod and explain them. If you have any doubts or questions, then feel free to ask them in the comment section. I will answer as soon as I see it. See you all in my next article😊.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit&lt;/strong&gt;:&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693"&gt;My Github&lt;/a&gt;&lt;br&gt;
🧙‍♂️&lt;a href="https://www.linkedin.com/in/arafat-freelancer"&gt;My LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Top 10 Full-stack Projects For Beginners</title>
      <dc:creator>Arafat</dc:creator>
      <pubDate>Sat, 22 Apr 2023 07:45:42 +0000</pubDate>
      <link>https://forem.com/arafat4693/top-10-full-stack-projects-for-beginners-1338</link>
      <guid>https://forem.com/arafat4693/top-10-full-stack-projects-for-beginners-1338</guid>
      <description>&lt;p&gt;Are you a beginner looking for good &lt;code&gt;full-stack&lt;/code&gt; project ideas to level your skills to the next level? Then look no further, as I will review some helpful and handy projects in this article. Building coding projects is a great way to have a fun and challenging experience that will help you improve your coding knowledge and understanding of web development.&lt;/p&gt;

&lt;p&gt;This blog post will showcase the Top 10 Best full-stack Projects for Beginners. Each project on this list is &lt;code&gt;simple&lt;/code&gt; and &lt;code&gt;challenging&lt;/code&gt; enough to help you learn new concepts and techniques that will make your web development journey easier.&lt;/p&gt;

&lt;p&gt;So let's dive in and start the project list.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. E-commerce Website
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682115887%2Fecommerce2_r5tk5l.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682115887%2Fecommerce2_r5tk5l.webp" alt="ecommerce"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a robust and user-friendly online store where customers can browse a wide range of products, add items to their cart, and securely checkout. The website will also provide features like order tracking, user profiles, and order history, making it a seamless shopping experience.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Product browsing and search functionality&lt;/li&gt;
&lt;li&gt;Add-to-cart and checkout process with payment integration&lt;/li&gt;
&lt;li&gt;Order management and tracking&lt;/li&gt;
&lt;li&gt;User profile and order history&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Social Media Platform
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682116180%2Fsocialmedia_p8bhdv.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682116180%2Fsocialmedia_p8bhdv.webp" alt="social media"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build a dynamic social media platform that allows users to connect with friends, create and manage their profiles, share posts, and interact with other users through comments and likes. In addition, the forum will provide a personalized news feed and timeline, making it easy for users to stay connected and engaged with their social circle.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Profile creation and management&lt;/li&gt;
&lt;li&gt;Friend requests and messaging functionality&lt;/li&gt;
&lt;li&gt;Post-creation, editing, and deletion&lt;/li&gt;
&lt;li&gt;News feed and timeline&lt;/li&gt;
&lt;li&gt;Like, comment, and share functionality&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Online Marketplace
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fky6j74sm0puauibfedtz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fky6j74sm0puauibfedtz.png" alt="Online Marketplace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Develop an online marketplace where users can buy and sell items securely and efficiently. The platform will offer features like item listings, search functionality, messaging between buyers and sellers, and payment integration, creating a safe and convenient online buying and selling experience.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Item listing and search functionality&lt;/li&gt;
&lt;li&gt;Add-to-cart and checkout process with payment integration&lt;/li&gt;
&lt;li&gt;User profiles and reviews/ratings&lt;/li&gt;
&lt;li&gt;Messaging and communication between buyers and sellers&lt;/li&gt;
&lt;li&gt;Order management and tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Task Management App
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147378%2Ftask_gt8i4f.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147378%2Ftask_gt8i4f.webp" alt="task"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build a comprehensive task management application that helps users create, assign, and track tasks, set deadlines, and collaborate with team members. In addition, the app will provide features such as notifications, task categorization, and progress tracking, making it a valuable tool for enhancing productivity and organization.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Task creation, assignment, and tracking&lt;/li&gt;
&lt;li&gt;Deadline setting and reminders&lt;/li&gt;
&lt;li&gt;Collaborative task management with team members&lt;/li&gt;
&lt;li&gt;Task categorization and prioritization&lt;/li&gt;
&lt;li&gt;Data visualization for task progress&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Recipe App
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147722%2Frecipe_auoigy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147722%2Frecipe_auoigy.webp" alt="recipe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a user-friendly recipe app allowing users to search and save recipes, create meal plans, and share recipes. In addition, the app will offer recipe categorization, ratings, and social sharing features, making it a go-to resource for discovering and organizing recipes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Recipe search and filtering by ingredients or categories&lt;/li&gt;
&lt;li&gt;Recipe saving and meal planning&lt;/li&gt;
&lt;li&gt;Recipe creation, editing, and deletion&lt;/li&gt;
&lt;li&gt;Reviews and ratings for recipes&lt;/li&gt;
&lt;li&gt;Social sharing and commenting on recipes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Blogging Platform
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147978%2Fblog_o6agtl.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682147978%2Fblog_o6agtl.webp" alt="blog"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build a versatile blogging platform that empowers users to create and publish blog posts, manage content, and engage with readers through comments and likes. The forum will offer features such as blog post categorization, author profiles, and search functionality, making it a powerful content creation and dissemination tool.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Blog post creation, editing, and deletion&lt;/li&gt;
&lt;li&gt;Blog post categorization and tagging&lt;/li&gt;
&lt;li&gt;User profiles and author management&lt;/li&gt;
&lt;li&gt;Commenting and liking on blog posts&lt;/li&gt;
&lt;li&gt;Search functionality for blog posts&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Job Board
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148295%2Fjob_pkvbai.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148295%2Fjob_pkvbai.webp" alt="job board"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Develop a comprehensive job board website that connects employers with job seekers in a user-friendly manner. The platform will provide features such as job posting, resume submission, and application tracking, making it a valuable resource for job seekers and employers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Employer and job seeker registration and authentication&lt;/li&gt;
&lt;li&gt;Job posting and search functionality&lt;/li&gt;
&lt;li&gt;Resume submission and application tracking&lt;/li&gt;
&lt;li&gt;Job alerts and notifications&lt;/li&gt;
&lt;li&gt;Employer profiles and company information&lt;/li&gt;
&lt;li&gt;Resume and job history management for job seekers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. Fitness Tracker
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148462%2Ffitness_gwfmaz.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148462%2Ffitness_gwfmaz.webp" alt="fitness trakcer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a fitness tracker app that helps users log their workouts, track their progress, and set fitness goals. The app will provide features such as exercise tracking, data visualization, and goal setting, making it a valuable tool for monitoring and improving fitness levels.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Exercise logging and tracking&lt;/li&gt;
&lt;li&gt;Data visualization for workout progress&lt;/li&gt;
&lt;li&gt;Goal setting and tracking&lt;/li&gt;
&lt;li&gt;Exercise categorization and tracking of different activities&lt;/li&gt;
&lt;li&gt;Calendar integration for tracking workout schedules&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. Event Management App
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148625%2Fevent_k1nojr.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148625%2Fevent_k1nojr.webp" alt="event"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build an event management app that simplifies creating, managing, and attending events. The app will offer features such as event creation, RSVP functionality, and notifications, making it easy for users to plan and participate in events and stay organized.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;User registration and authentication&lt;/li&gt;
&lt;li&gt;Event creation, editing, and deletion&lt;/li&gt;
&lt;li&gt;RSVP functionality and attendee management&lt;/li&gt;
&lt;li&gt;Event invitations and notifications&lt;/li&gt;
&lt;li&gt;Event details and location information&lt;/li&gt;
&lt;li&gt;Calendar integration for tracking events&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  10. Weather App
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148699%2Fweather_fzvmrb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdafxmvvzp%2Fimage%2Fupload%2Fv1682148699%2Fweather_fzvmrb.webp" alt="weather"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a weather app that provides real-time weather data, weather forecasts, and location-based updates. In addition, the app will offer features such as weather alerts, data visualization, and search functionality, making it a reliable source of weather information for users on the go.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Challenges&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Real-time weather data display for different locations&lt;/li&gt;
&lt;li&gt;Weather forecasts for multiple days&lt;/li&gt;
&lt;li&gt;Location-based weather updates&lt;/li&gt;
&lt;li&gt;Data visualization for weather information&lt;/li&gt;
&lt;li&gt;Search functionality for different locations&lt;/li&gt;
&lt;li&gt;Weather alerts and notifications&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, these full-stack projects offer an excellent opportunity for web developers to improve their coding skills. Whether you’re a beginner or an intermediate developer, these projects can challenge you and help you expand your knowledge of front-end and back-end.&lt;br&gt;
So, choose a project that interests you, get ready to code, and enjoy the learning experience—building these projects independently rather than simply copying the others is best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visit:&lt;/strong&gt;&lt;br&gt;
👨‍💻&lt;a href="https://portfolio-khaki-iota-89.vercel.app/" rel="noopener noreferrer"&gt;My Portfolio&lt;/a&gt;&lt;br&gt;
🏞️&lt;a href="https://www.fiverr.com/sunnyislam990" rel="noopener noreferrer"&gt;My Fiverr&lt;/a&gt;&lt;br&gt;
🌉&lt;a href="https://github.com/arafat4693" rel="noopener noreferrer"&gt;My Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
