<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Harsh</title>
    <description>The latest articles on DEV Community by Harsh (@senbo).</description>
    <link>https://dev.to/senbo</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%2F1048268%2F476892c3-d22f-4f6b-8c6f-30c66bf59d9b.png</url>
      <title>DEV Community: Harsh</title>
      <link>https://dev.to/senbo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/senbo"/>
    <language>en</language>
    <item>
      <title>GSoC 2025 – Week 11 with CircuitVerse 🚀</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Mon, 18 Aug 2025 08:31:43 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-11-with-circuitverse-4611</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-11-with-circuitverse-4611</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 11 was a big one. Our &lt;strong&gt;Landing Page Revamp&lt;/strong&gt; is now live in production 🎉 and we made strong progress on the &lt;strong&gt;search experience&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🏠 Landing Page Revamp – Merged and Live
&lt;/h3&gt;

&lt;p&gt;The completely redesigned &lt;strong&gt;Landing Page&lt;/strong&gt; is finally merged and deployed to production.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built with modular &lt;strong&gt;ViewComponents&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Includes &lt;strong&gt;RTL support&lt;/strong&gt; from the ground up&lt;/li&gt;
&lt;li&gt;Matches the approved Figma design across all sections&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was one of the largest UI revamp efforts so far and a major milestone for the project.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔎 Sorting PR – Final Changes
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Sorting PR&lt;/strong&gt; is now ready for merge, with the final refinements added this week:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed &lt;strong&gt;margin gaps&lt;/strong&gt; in Project Search results&lt;/li&gt;
&lt;li&gt;Added &lt;strong&gt;auto-submit on resource change&lt;/strong&gt; (Projects vs Users)&lt;/li&gt;
&lt;li&gt;Added &lt;strong&gt;auto-submit on sorting option selection&lt;/strong&gt;, removing the need to click the Search button manually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These changes make sorting smoother, faster, and more intuitive.&lt;/p&gt;




&lt;h3&gt;
  
  
  🎛 Filters – In Progress
&lt;/h3&gt;

&lt;p&gt;Work on the &lt;strong&gt;Filters PR&lt;/strong&gt; is almost complete:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Added &lt;strong&gt;Apply&lt;/strong&gt; and &lt;strong&gt;Clear&lt;/strong&gt; buttons for easier filter management&lt;/li&gt;
&lt;li&gt;Implemented multi-select for &lt;strong&gt;tags&lt;/strong&gt; in projects&lt;/li&gt;
&lt;li&gt;Added country dropdown and institute text field filters for users&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;Sorting PR&lt;/strong&gt; should be merged early next week, and the &lt;strong&gt;Filters PR&lt;/strong&gt; will follow immediately after (target: Tuesday).&lt;/p&gt;




&lt;h3&gt;
  
  
  📌 Next Steps (Week 12 Plan)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Begin work on the &lt;strong&gt;Email Verification Flow&lt;/strong&gt; to improve onboarding&lt;/li&gt;
&lt;li&gt;Polish and test the new Search Filters for a smooth rollout&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 10 with CircuitVerse 🎯</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Tue, 12 Aug 2025 06:51:33 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-10-with-circuitverse-1gn7</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-10-with-circuitverse-1gn7</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 10 was all about wrapping up &lt;strong&gt;sorting&lt;/strong&gt;, finalizing &lt;strong&gt;filters&lt;/strong&gt;, and preparing for the next set of features.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔢 Sorting PR – Finalized &amp;amp; Ready
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Sorting PR&lt;/strong&gt; is now finalized with all remaining UI tweaks completed, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Responsive design&lt;/strong&gt; for better usability on mobile and tablet&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Sorting icons&lt;/strong&gt; to clearly indicate active sort order&lt;/li&gt;
&lt;li&gt;✅ Polished dropdown styling for a consistent look with the rest of the app&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With backend and frontend now fully integrated, this feature is ready for merge.&lt;/p&gt;




&lt;h3&gt;
  
  
  🎛 Filters – Ready for PR
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Search Filters&lt;/strong&gt; feature is also complete and will be opened as a PR right after the Sorting PR merges to avoid merge conflicts.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Projects Search Filters&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Filter by tags&lt;/strong&gt; – Multi-select input allowing users to add or remove multiple tags for precise filtering.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Users Search Filters&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Filter by country&lt;/strong&gt; – Dropdown list to select a country.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter by institute&lt;/strong&gt; – Text field for searching by institute name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The backend implementation is already in place, so the PR will deliver a &lt;strong&gt;fully functional filtering system&lt;/strong&gt; on day one.&lt;/p&gt;




&lt;h3&gt;
  
  
  📌 Next Week’s Focus (Week 11 Plan)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start work on the &lt;strong&gt;Email Verification Flow&lt;/strong&gt; to improve onboarding and user trust.&lt;/li&gt;
&lt;li&gt;Migrate the &lt;strong&gt;remaining ViewComponents&lt;/strong&gt; (Team Section on About Page, Text Editor, etc.).&lt;/li&gt;
&lt;li&gt;Merge Filters PR after Sorting PR is in &lt;code&gt;master&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With sorting and filtering nearly done, the search experience is about to become much more powerful and user-friendly.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 9 with CircuitVerse ⚙️</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Wed, 06 Aug 2025 14:05:47 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-9-with-circuitverse-17j0</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-9-with-circuitverse-17j0</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 9 was focused on enhancing the &lt;strong&gt;search experience&lt;/strong&gt; through improved &lt;strong&gt;sorting mechanics&lt;/strong&gt; and a clean, modular UI implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔢 Sorting PR: Backend &amp;amp; Frontend Integration
&lt;/h3&gt;

&lt;p&gt;We opened a comprehensive PR that added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;✅ &lt;strong&gt;Counter cache columns&lt;/strong&gt; for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;stars_count&lt;/code&gt; on &lt;strong&gt;projects&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;projects_count&lt;/code&gt; on &lt;strong&gt;users&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This allows us to sort results &lt;strong&gt;efficiently&lt;/strong&gt; using precomputed values instead of expensive &lt;code&gt;COUNT(*)&lt;/code&gt; queries, which improves &lt;strong&gt;performance and scalability&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;On the frontend side, we:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Created a &lt;strong&gt;sorting UI component&lt;/strong&gt; that dynamically adjusts options based on whether the user is browsing &lt;strong&gt;projects&lt;/strong&gt; or &lt;strong&gt;users&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;✅ Hooked into the &lt;strong&gt;query parameters&lt;/strong&gt; from the URL to initialize the UI with the correct state&lt;/li&gt;
&lt;li&gt;✅ Made the &lt;strong&gt;select dropdown&lt;/strong&gt; the secondary source of truth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📦 Stimulus Controller for Sorting UI
&lt;/h3&gt;

&lt;p&gt;We used a &lt;strong&gt;Stimulus controller&lt;/strong&gt; to manage this sorting UI, ensuring modular, clean code and proper &lt;strong&gt;separation of concerns&lt;/strong&gt;. This allowed us to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Isolate behavior for easier testing and maintenance&lt;/li&gt;
&lt;li&gt;Update the UI reactively based on changes in state or URL&lt;/li&gt;
&lt;li&gt;Keep logic scoped tightly to the component that needs it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This PR took more time than usual as we spent time &lt;strong&gt;learning and applying Stimulus&lt;/strong&gt; to build production-grade modular code.&lt;/p&gt;




&lt;h3&gt;
  
  
  📌 What's Next (Week 10 Plan)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;✅ Finalize and &lt;strong&gt;merge&lt;/strong&gt; the Sorting PR after one last review&lt;/li&gt;
&lt;li&gt;🚧 Raise the PR for &lt;strong&gt;Search Filters UI&lt;/strong&gt;, which will allow users to filter projects by tags and users by roles/interests&lt;/li&gt;
&lt;li&gt;⌛ Complete the &lt;strong&gt;Footer section&lt;/strong&gt; for the Landing Page Revamp once design discussions are finalized&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Week 9 was slower in terms of visible output, but a lot of foundational work has been laid for a smoother Phase 2 rollout.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 8 with CircuitVerse 🔍</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Tue, 29 Jul 2025 16:56:04 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-8-with-circuitverse-4oho</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-8-with-circuitverse-4oho</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Since Week 7’s work was covered in our mid‑term report, here’s a focused recap of what &lt;strong&gt;we&lt;/strong&gt; accomplished in Week 8:&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ User Card Revamp UI Merged
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Our &lt;strong&gt;User Card ViewComponent revamp&lt;/strong&gt; PR was officially merged (originally drafted in Week 6 / covered in mid‑term).&lt;/li&gt;
&lt;li&gt;The new design aligns with the approved Figma specs and includes full RTL support, accessible markup, and isolated component previews.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🏠 Landing Page Revamp – Footer Discussion Pending
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Landing (Home) Page Revamp&lt;/strong&gt; is nearly complete! We’ve implemented all major sections—Hero, Features, Testimonials, and Call‑to‑Action—using modular ViewComponents and built‑in RTL styling.&lt;/li&gt;
&lt;li&gt;Only the &lt;strong&gt;Footer section&lt;/strong&gt; remains. We’ve flagged it for a quick design discussion before starting development to ensure link structure, social integrations, and legal text meet project standards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔍 Search Page: Sorting &amp;amp; Filtering (Backend)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Counter caches&lt;/strong&gt; have been added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Projects&lt;/strong&gt; now maintain a &lt;code&gt;stars_count&lt;/code&gt; column&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users&lt;/strong&gt; now maintain a &lt;code&gt;projects_count&lt;/code&gt; column&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;These caches allow us to &lt;strong&gt;sort and filter&lt;/strong&gt; in constant time (O(1) reads) instead of issuing &lt;code&gt;COUNT(*)&lt;/code&gt; queries on every request, improving response speed and reducing database load.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;The backend endpoint for &lt;strong&gt;sorting by popularity&lt;/strong&gt; (stars or project‑count) is fully implemented and covered by unit tests.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h4&gt;
  
  
  Next up (Week 9)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Finalize and merge the &lt;strong&gt;Search Page filter UI&lt;/strong&gt; alongside sorting controls.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 6 with CircuitVerse 🚀</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Mon, 14 Jul 2025 12:42:58 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-6-with-circuitverse-1l9l</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-6-with-circuitverse-1l9l</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 6 marked another big milestone — the &lt;strong&gt;Landing Page Revamp PR&lt;/strong&gt; is now live, and the &lt;strong&gt;User Card PR&lt;/strong&gt; is all set for merge after feedback resolution. Here's a quick recap of the week:&lt;/p&gt;

&lt;h3&gt;
  
  
  🏠 Landing Page Revamp PR Created
&lt;/h3&gt;

&lt;p&gt;This week, I officially opened the PR for the &lt;strong&gt;Landing (Home) Page Revamp&lt;/strong&gt;, which includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ A redesigned &lt;strong&gt;Hero Section&lt;/strong&gt; and other key sections based on the approved Figma design&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;RTL support&lt;/strong&gt; built in from the start&lt;/li&gt;
&lt;li&gt;✅ Modular ViewComponents for better structure and reusability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This revamp lays the foundation for a modern, accessible, and visually consistent landing experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  👤 Final Touches on User Card PR
&lt;/h3&gt;

&lt;p&gt;I also resolved all remaining comments on the &lt;strong&gt;User Card ViewComponent Revamp&lt;/strong&gt; PR. &lt;/p&gt;

&lt;p&gt;That’s it for Week 6! The focus now shifts to reviewing the landing page changes, handling any feedback, and preparing for final cleanup and testing in the weeks ahead.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 5 with CircuitVerse 💡</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Mon, 07 Jul 2025 21:56:21 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-5-with-circuitverse-5d9a</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-5-with-circuitverse-5d9a</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 5 was all about &lt;strong&gt;closing loops&lt;/strong&gt;, &lt;strong&gt;resolving feedback&lt;/strong&gt;, and making progress on one of the most visible pages of CircuitVerse — the &lt;strong&gt;Home Page&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Merged: Project Card &amp;amp; Search Bar UI Revamp
&lt;/h3&gt;

&lt;p&gt;This week, I focused on addressing review comments and got two major PRs &lt;strong&gt;successfully merged&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project Card UI Revamp&lt;/strong&gt; – Final UI tweaks were made to align with the design system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search Bar UI Revamp&lt;/strong&gt; – Resolved all conversations, including accessibility improvements and UI consistency fixes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both components are now part of the codebase and live with the new UI!&lt;/p&gt;

&lt;h3&gt;
  
  
  👤 User Card UI Revamp PR Progress
&lt;/h3&gt;

&lt;p&gt;I created the PR for the &lt;strong&gt;User Card UI revamp&lt;/strong&gt;, and as of now, most review conversations have been resolved. Just a few finishing touches left before it’s ready to merge.&lt;/p&gt;

&lt;h3&gt;
  
  
  🏠 Home Page Revamp (In Progress)
&lt;/h3&gt;

&lt;p&gt;One of the bigger updates this week is the &lt;strong&gt;draft PR for the Home Page revamp&lt;/strong&gt;. The new layout will include multiple redesigned sections based on the approved Figma designs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ The &lt;strong&gt;Hero Section&lt;/strong&gt; is already implemented.&lt;/li&gt;
&lt;li&gt;🚧 Work is ongoing to complete the remaining sections.&lt;/li&gt;
&lt;li&gt;🌐 &lt;strong&gt;RTL support&lt;/strong&gt; is also being built into the Home Page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The complete PR is on track to be finalized and opened for review in &lt;strong&gt;Week 6&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;That's it for Week 5!, I’m looking forward to wrapping up the Home Page and polishing the final pieces in the coming weeks.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 4 with CircuitVerse 🧩</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Mon, 30 Jun 2025 16:01:44 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-4-with-circuitverse-312p</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-4-with-circuitverse-312p</guid>
      <description>&lt;h2&gt;
  
  
  GSoC 2025 – Week 4 with CircuitVerse 🧩
&lt;/h2&gt;

&lt;p&gt;Hi everyone!&lt;br&gt;
Week 4 was focused on &lt;strong&gt;resolving feedback&lt;/strong&gt;, &lt;strong&gt;getting key PRs merged&lt;/strong&gt;, and continuing to align our UI components with the approved Figma designs. Here's a breakdown of what I accomplished:&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Resolved Feedback &amp;amp; Directory Fixes
&lt;/h3&gt;

&lt;p&gt;I addressed mentor feedback on the &lt;strong&gt;View Component PRs&lt;/strong&gt; by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Refactoring the directory name from &lt;code&gt;/component&lt;/code&gt; to &lt;code&gt;/components&lt;/code&gt; (to follow Rails conventions using the plural form)&lt;/li&gt;
&lt;li&gt;Fixing minor issues and cleaning up the structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helped align the project with community standards and improve clarity across the codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 PRs Merged This Week
&lt;/h3&gt;

&lt;p&gt;Excitingly, several important PRs were merged:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Contribute Card ViewComponent Migration&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Project Card ViewComponent Migration&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;User Card ViewComponent Migration&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This completes the migration of all major cards in the app to ViewComponents, making them more reusable and maintainable.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎨 Project Card UI Revamp PR
&lt;/h3&gt;

&lt;p&gt;I also opened a new PR to &lt;strong&gt;revamp the Project Card UI&lt;/strong&gt; on the search page, matching the latest Figma designs. This involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Styling updates to match spacing, font, and layout specs&lt;/li&gt;
&lt;li&gt;Making the ViewComponent more design-consistent and responsive&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔍 Search Bar UI Enhancements
&lt;/h3&gt;

&lt;p&gt;For the ongoing &lt;strong&gt;Search Bar Revamp&lt;/strong&gt; PR, I made several key improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Created a &lt;strong&gt;custom preview layout&lt;/strong&gt; for all ViewComponents, making it easier to visualize and test UI in isolation in Lookbook&lt;/li&gt;
&lt;li&gt;✅ Added &lt;strong&gt;keyboard navigation&lt;/strong&gt; support to the custom select dropdown — improving accessibility and user experience&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;That wraps up Week 4! I'm happy to see more components polished, merged, and aligned with the new design system. Onward to finishing up the remaining UI components and refining interactivity next week!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 3 with CircuitVerse 🔄</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Sun, 22 Jun 2025 13:19:05 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-3-with-circuitverse-2pf8</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-3-with-circuitverse-2pf8</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 3 of GSoC has been all about &lt;strong&gt;breaking down complexity&lt;/strong&gt;, &lt;strong&gt;enhancing reusability&lt;/strong&gt;, and pushing forward with ViewComponent migrations and UI Revamp. Here's what I’ve been up to:&lt;/p&gt;

&lt;h3&gt;
  
  
  🧩 More UI Elements Migrated to ViewComponent
&lt;/h3&gt;

&lt;p&gt;This week, I continued migrating UI components into ViewComponents to improve modularity and maintainability. I made PR for migrating:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ The &lt;strong&gt;Pagination component&lt;/strong&gt; used on the search page&lt;/li&gt;
&lt;li&gt;✅ The &lt;strong&gt;Contribute Card&lt;/strong&gt; shown on the contribute page&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔍 Header Refactor &amp;amp; Search Bar Revamp
&lt;/h3&gt;

&lt;p&gt;Last week’s large header PR was broken down into two focused PRs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Search Bar Migration&lt;/strong&gt; – Extracted the search bar into a reusable ViewComponent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Header UI Revamp&lt;/strong&gt; – Implemented the new header UI as per the Figma design with &lt;strong&gt;RTL support&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I also made a separate PR to &lt;strong&gt;revamp the UI of the search bar&lt;/strong&gt;, improving both style and structure in line with the new design system.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠️ Cleanup: Removing Deprecated &lt;code&gt;current_user&lt;/code&gt; Usage
&lt;/h3&gt;

&lt;p&gt;While working on the &lt;strong&gt;Project Card migration&lt;/strong&gt;, the legacy feature flag for S3 support was still present. Since S3 is now fully rolled out, I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Removed &lt;code&gt;current_user&lt;/code&gt; being passed unnecessarily&lt;/li&gt;
&lt;li&gt;✅ Cleaned up the related helper method by removing the feature flag logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helped simplify the component and align it with the current production behavior.&lt;/p&gt;




&lt;p&gt;That's it for Week 3!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 2 with CircuitVerse 🚀</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Sun, 15 Jun 2025 09:41:25 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-2-with-circuitverse-mlb</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-2-with-circuitverse-mlb</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Week 2 of Google Summer of Code 2025 has been productive, with a strong focus on component migration and aligning the UI with our approved Figma design.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱 Migrating the Header &amp;amp; RTL Support
&lt;/h3&gt;

&lt;p&gt;This week, my main task was to migrate the &lt;strong&gt;Header UI&lt;/strong&gt; to match the finalized &lt;strong&gt;Figma design&lt;/strong&gt;. Along with this, I also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Added RTL (Right-to-Left) support&lt;/strong&gt; to ensure better accessibility and internationalization&lt;/li&gt;
&lt;li&gt;✅ Migrated the &lt;strong&gt;Header and Notification partial&lt;/strong&gt; into a &lt;strong&gt;ViewComponent&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The changes were quite extensive, the PR reached over &lt;strong&gt;500+ lines of code&lt;/strong&gt;. Following a discussion with my mentor, I’m now working on &lt;strong&gt;splitting it into smaller, more manageable PRs&lt;/strong&gt;, which will make the review process smoother and faster.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 More ViewComponent Migrations
&lt;/h3&gt;

&lt;p&gt;In addition to the header work, I also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Migrated the &lt;strong&gt;Project Card&lt;/strong&gt; to a ViewComponent&lt;/li&gt;
&lt;li&gt;✅ Migrated the &lt;strong&gt;User Card&lt;/strong&gt; to a ViewComponent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These migrations are part of the broader effort to make the codebase more modular, testable, and maintainable using ViewComponent architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 A Small Discovery
&lt;/h3&gt;

&lt;p&gt;While working on the search functionality, I discovered that project search can be &lt;strong&gt;filtered by tags&lt;/strong&gt; using the URL pattern &lt;code&gt;/projects/tags/:tag&lt;/code&gt;. This insight could be helpful as we finalize the filtering UX in the upcoming search improvements.&lt;/p&gt;




&lt;p&gt;That's a wrap for Week 2! I'm enjoying the process of learning, refining, and pushing changes that move the project forward. Thanks to my mentors for their guidance and feedback.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GSoC 2025 – Week 1 with CircuitVerse 🚀</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Mon, 09 Jun 2025 04:17:48 +0000</pubDate>
      <link>https://dev.to/senbo/gsoc-2025-week-1-with-circuitverse-2inh</link>
      <guid>https://dev.to/senbo/gsoc-2025-week-1-with-circuitverse-2inh</guid>
      <description>&lt;p&gt;Hey everyone!&lt;br&gt;
Here’s a quick update on what I worked on during &lt;strong&gt;Week 1&lt;/strong&gt; of Google Summer of Code 2025 with &lt;a href="https://circuitverse.org/" rel="noopener noreferrer"&gt;CircuitVerse&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧩 Design Discussions
&lt;/h3&gt;

&lt;p&gt;Before the coding period officially began, we had a focused meeting to discuss and iterate on the &lt;strong&gt;new search UI&lt;/strong&gt; in Figma. The design is now almost complete! We’re currently finalizing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to display &lt;strong&gt;filters&lt;/strong&gt; in the UI&lt;/li&gt;
&lt;li&gt;Which filters will be available for both &lt;strong&gt;user search&lt;/strong&gt; and &lt;strong&gt;project search&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This final touch will ensure the search experience is intuitive and powerful for all users, I will be working on this during week 2.&lt;/p&gt;

&lt;h3&gt;
  
  
  💻 Coding Contributions
&lt;/h3&gt;

&lt;p&gt;I’ve started off the coding period by working on a few migration tasks and community contributions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;✅ &lt;strong&gt;Opened 2 PRs&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Migrated Text Editor Partial to view component&lt;/li&gt;
&lt;li&gt;Migrated Team Sections to view component&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;🛠️ Created a Good First Issue to help onboard a new contributor to the repository&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;That’s it for Week 1! Looking forward to finalizing the design and diving deeper into implementation in the coming weeks. Thanks to my mentors and the CircuitVerse community for all the support!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Community Bonding with CircuitVerse - GSoC 2025</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Fri, 30 May 2025 19:58:50 +0000</pubDate>
      <link>https://dev.to/senbo/community-bonding-with-circuitverse-gsoc-2025-54aa</link>
      <guid>https://dev.to/senbo/community-bonding-with-circuitverse-gsoc-2025-54aa</guid>
      <description>&lt;p&gt;Hello everyone!&lt;br&gt;
I’m excited to share my experience from the Community Bonding period of Google Summer of Code 2025 with CircuitVerse.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started 🚀
&lt;/h3&gt;

&lt;p&gt;During these first few weeks, I spent time familiarizing myself with the community, codebase, and workflows. CircuitVerse has an incredibly welcoming and helpful community, which made it easy to settle in.&lt;/p&gt;

&lt;p&gt;We had &lt;strong&gt;bi-weekly community meetings&lt;/strong&gt; where all GSoC contributors, mentors, and other active members shared progress, plans, and even small wins from the past week. These meetings were a great way to stay aligned with the broader goals of the organization and stay motivated.&lt;/p&gt;

&lt;p&gt;Apart from that, I also participated in recommended activities for the bonding period, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exploring previous GSoC projects for context and inspiration&lt;/li&gt;
&lt;li&gt;Discussing design directions with other contributors&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Mentor Meetings 💬
&lt;/h3&gt;

&lt;p&gt;In addition to the community sync-ups, I had &lt;strong&gt;weekly 1:1 meetings with my mentors&lt;/strong&gt;, which were incredibly valuable. We had in-depth discussions about the &lt;strong&gt;search improvements for Project 3&lt;/strong&gt;, one of the core focus of my summer contribution.&lt;/p&gt;

&lt;p&gt;During these sessions, we are trying to finalize the &lt;strong&gt;Figma design for the new search experience&lt;/strong&gt;, aligning on both functionality and UI/UX principles. The iterative design process and constant feedback will help shape a solution that is both user-friendly and technically feasible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Looking Ahead 🔧
&lt;/h3&gt;

&lt;p&gt;With a strong foundation laid, I will be moving into the coding phase with a clear roadmap and solid support from the CircuitVerse community and my mentors. I’m excited to start implementing the search enhancements and contribute to making CircuitVerse even more accessible and efficient for users.&lt;/p&gt;

&lt;p&gt;Thank you to the entire community and my mentors for making this an engaging and collaborative experience so far. Looking forward to sharing more updates soon!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Just enough Typescript to build Projects.</title>
      <dc:creator>Harsh</dc:creator>
      <pubDate>Tue, 11 Jul 2023 10:49:02 +0000</pubDate>
      <link>https://dev.to/senbo/just-enough-typescript-to-build-projects-a4o</link>
      <guid>https://dev.to/senbo/just-enough-typescript-to-build-projects-a4o</guid>
      <description>&lt;h2&gt;
  
  
  What is the point of using TypeScript ?
&lt;/h2&gt;

&lt;p&gt;JavaScript is a &lt;strong&gt;dynamically typed language&lt;/strong&gt; meaning &lt;strong&gt;type checking is performed at runtime&lt;/strong&gt; or at the time of execution. &lt;/p&gt;

&lt;p&gt;JavaScript allows accessing values which aren't present leading to unexpected bugs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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="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;John Doe&lt;/span&gt;&lt;span class="dl"&gt;"&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;1&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;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;- undefined&lt;/span&gt;
&lt;span class="nx"&gt;person&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="nf"&gt;toUppercase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;- will throw TypeError&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript was created to solve these type of problems by adding static type checking to JavaScript.&lt;/p&gt;

&lt;p&gt;Think of JavaScript as a person which doesn't provide feedback until you Beat the s- I mean ask it. The feedback provided however is not much in-depth such as where might the error be until you console log it like above.&lt;/p&gt;

&lt;p&gt;TypeScript is a &lt;strong&gt;typed superset of JavaScript which provides static type checking&lt;/strong&gt; (type checking is performed at compile time) to catch potential bugs before runtime. It adds &lt;strong&gt;type safety&lt;/strong&gt; to your JavaScript code.&lt;/p&gt;

&lt;p&gt;With TypeScript, The above code will now throw an error in the IDE before runtime.&lt;/p&gt;

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

&lt;p&gt;Typescript is basically a more wiser version of JavaScript which helps you catch a lot of errors including typos, uncalled function (Math.random * 6), etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;types + Javascript = Typescript.&lt;/p&gt;

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

&lt;p&gt;Before using Typescript we need to know about JavaScript types and some special TypeScript types.&lt;/p&gt;

&lt;p&gt;Here are a bunch of them - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;string&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;number&lt;/code&gt; (there's no int or float data type in JavaScript)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Arrays (datatype[] or &lt;code&gt;Array&amp;lt;datatype&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;object ({}) &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;any&lt;/code&gt; (NOTE :- This removes the type safety provided by TS, meaning you will be back to the same old JavaScript for that particular variable)&lt;/li&gt;
&lt;li&gt;undefined &lt;/li&gt;
&lt;li&gt;void&lt;/li&gt;
&lt;li&gt;never&lt;/li&gt;
&lt;li&gt;unknown&lt;/li&gt;
&lt;li&gt;Union Types (combination of two or more types)&lt;/li&gt;
&lt;li&gt;Enum &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type Annotations and Inference
&lt;/h2&gt;

&lt;p&gt;TypeScript allows you to optionally specify the type of variable while declaring it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;senbo&lt;/span&gt;&lt;span class="dl"&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;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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;isEven&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&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;let&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&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="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="mi"&gt;4&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;a&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;b&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&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="nx"&gt;number&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="na"&gt;a&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;b&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; 
&lt;span class="kd"&gt;let&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;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// union type, age is either a number or string&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="na"&gt;alignment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;left&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;centre&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;right&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Union of literal types&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are called &lt;strong&gt;Type Annotations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the example of object, we use &lt;code&gt;;&lt;/code&gt; separate the properties and declare a property optional by adding &lt;code&gt;?&lt;/code&gt; after its name.&lt;/p&gt;

&lt;p&gt;But this is redundant as TypeScript can automatically infer the type of variable based on assigned value. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3doonrn1ivdz93e5xnib.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3doonrn1ivdz93e5xnib.png" alt="Type Inference" width="421" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;Type Inference&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Functions in TypeScript
&lt;/h2&gt;

&lt;p&gt;While declaring a function you can add Type Annotations to parameters and return type, so that arguments to that function gets checked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;number&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above function, a and b are assigned the type &lt;code&gt;number&lt;/code&gt; as well as the return type which comes after the closing parenthesis of parameter list, note that the return type can be inferred by typescript so it is not necessary to write always. &lt;/p&gt;

&lt;p&gt;Here are some more examples&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;print&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="nx"&gt;string&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="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="s2"&gt;`Hello &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="s2"&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;function&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;[]):&lt;/span&gt; &lt;span class="nx"&gt;number&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;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;acc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;curr&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;acc&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;curr&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;printLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Length:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Lengths:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&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;str&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first function, &lt;code&gt;print&lt;/code&gt;, simply console logs the string, hence the return type is void.&lt;br&gt;
The second function, &lt;code&gt;sum&lt;/code&gt;, uses the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters" rel="noopener noreferrer"&gt;Rest parameters&lt;/a&gt; syntax, allowing it to accept an indefinite number of arguments so we use array of numbers. &lt;br&gt;
You may want to revisit &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce" rel="noopener noreferrer"&gt;reduce&lt;/a&gt; function.&lt;br&gt;
and in the last function, &lt;code&gt;printlength&lt;/code&gt;, item is either a string or an array of string, inside the function we use &lt;code&gt;typeof&lt;/code&gt; to check its type. If it is a &lt;code&gt;string&lt;/code&gt;, we simply log the length of the string otherwise if it is an array, we iterate over each string in the array and log their lengths. This is called &lt;strong&gt;Narrowing&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Type Aliases
&lt;/h2&gt;

&lt;p&gt;It is a name for a type, It is used to create reusable types or if you simply want to separate writing types for convenience.&lt;/p&gt;

&lt;p&gt;You may capitalize type aliases name to differentiate them from variables and functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Person&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="nx"&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="nx"&gt;number&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;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&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="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="s2"&gt;`Hi &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;p&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="s2"&gt;, you are &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;p&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="s2"&gt; years old`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;greet&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;John Doe&lt;/span&gt;&lt;span class="dl"&gt;"&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="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Some more examples&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NaturalNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&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="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;readonly&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;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// This property cannot be re-assigned.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can use type aliases to create &lt;strong&gt;function type expressions&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;func&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// function type expression&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greets&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="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;func&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;callback&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="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;greets&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &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="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="s2"&gt;`Hi &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="s2"&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;The above type &lt;code&gt;func&lt;/code&gt; means a function with one parameter of type &lt;code&gt;string&lt;/code&gt; and returns nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interfaces
&lt;/h2&gt;

&lt;p&gt;Interfaces are another way to name an object type. They are similar to Type Aliases but have some distinctions which we'll talk about later.&lt;/p&gt;

&lt;p&gt;Syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Book&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;pageCount&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;number&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;book&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Book&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The Great Gatsby&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;F. Scott Fitzgerald&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AnotherInterface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;func&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// describe a function inside interface&lt;/span&gt;
  &lt;span class="nf"&gt;func2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&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;// another way to describe a function&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// This is function type, functions in JavaScript are objects which can be called, and we can also add properties to our functions.&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;MathOperation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;number&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;add&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;MathOperation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&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;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;y&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;subtract&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;MathOperation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&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;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Its type aliases equivalent&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;MathOperationType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some key differences between Types and Interfaces&lt;/p&gt;

&lt;p&gt;Types aliases do not support declaration merging while interfaces do.&lt;/p&gt;

&lt;p&gt;Declaration merging is adding new properties to an existing interface.&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 javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&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;printobj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;a&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;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both Interface and types can be extended but have different syntax.&lt;/p&gt;

&lt;p&gt;You can read more about these distinctions &lt;a href="https://stackoverflow.com/questions/37233735/interfaces-vs-types-in-typescript" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can use whatever you like, I generally use interfaces for objects and types for everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generics
&lt;/h2&gt;

&lt;p&gt;lets say you wanna create a function that accepts an argument and returns it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;identity&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;any&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;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;let&lt;/span&gt; &lt;span class="nx"&gt;num&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;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works fine but the issue with this is we lose all our type definitions for the return value of the function. If we pass in an argument of type &lt;code&gt;number&lt;/code&gt;, the function returns the same argument but with type &lt;code&gt;any&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyp2d7qouibhf7e3g8xeb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyp2d7qouibhf7e3g8xeb.png" alt="Type is any" width="374" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By using generic this problem can be solved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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="c1"&gt;// Two ways of consuming generic functions&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num0&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;number&lt;/span&gt;&lt;span class="o"&gt;&amp;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;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// explicitly passing the T parameter&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&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;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// let the compiler infer it&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xwzsl7461fnu9zq4t7v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xwzsl7461fnu9zq4t7v.png" alt="Type is number" width="409" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;T&lt;/code&gt; in the angle bracket is called the Type Variable, you can name it whatever you like.&lt;/p&gt;

&lt;p&gt;Generics are used to create reusable components that work with different types of data.&lt;/p&gt;

&lt;p&gt;Let's say now we want to pass an array of different types and return it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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="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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice we don't have to specify the return type as the compiler can infer it.&lt;/p&gt;

&lt;p&gt;If we want to have a generic type for types with a length property such as string and arrays. We can use something called a constraint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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="kd"&gt;extends&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="nx"&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="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="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="nx"&gt;length&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;In similar way we can create generic interfaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Box&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="na"&gt;value&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="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NumberBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Box&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&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;type&lt;/span&gt; &lt;span class="nx"&gt;StringBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Box&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tuples
&lt;/h2&gt;

&lt;p&gt;Tuples are array but with a pre-defined length and types for each index.&lt;/p&gt;

&lt;p&gt;Syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;FirstTuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;SecondTuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;boolean&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;firstTuple&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FirstTuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2&lt;/span&gt;&lt;span class="dl"&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;secondTuple&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;SecondTuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;'&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FirstTuple is an array of fixed length 2 with index 0 being a number and index 1 being a string. if we try access element past index 1, TypeScript will throw error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhj3ucxuvkarptjz8z4o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhj3ucxuvkarptjz8z4o.png" alt="TypeScript Error Image" width="748" height="138"&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  never
&lt;/h2&gt;

&lt;p&gt;Type when function &lt;strong&gt;never&lt;/strong&gt; returns a value, it is similar to void but it is used when function throws an exception or if a function enters an infinite loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;throwError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&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;infiniteLoop&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;while &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="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&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;h2&gt;
  
  
  Non-null Assertion Operator (Postfix !)
&lt;/h2&gt;

&lt;p&gt;It is used to tell the compiler to assume that a value is not &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, even if typescript thinks it could be nullable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;func&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;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="o"&gt;!++&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Type Assertions
&lt;/h2&gt;

&lt;p&gt;Type Assertions are way to override the type inference and explicitly set the type. &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 javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;btn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;my_button&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="nx"&gt;HTMLButtonElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript thinks that getElementById will return some kind of HTMLElement, but you can override this by using the &lt;code&gt;as&lt;/code&gt; operator.&lt;/p&gt;

&lt;p&gt;Thanks for reading, I tried to condense as much as examples possible and tried cover most frequently used types.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>tutorial</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
