<?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: harshit mishra </title>
    <description>The latest articles on DEV Community by harshit mishra  (@harshit_senpai).</description>
    <link>https://dev.to/harshit_senpai</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%2F1048798%2F89c61060-fccc-4d41-a9fa-744b50251bf3.jpg</url>
      <title>DEV Community: harshit mishra </title>
      <link>https://dev.to/harshit_senpai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harshit_senpai"/>
    <language>en</language>
    <item>
      <title>NPM v/s NPX</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Mon, 08 Jan 2024 08:22:00 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/npm-vs-npx-41bf</link>
      <guid>https://dev.to/harshit_senpai/npm-vs-npx-41bf</guid>
      <description>&lt;p&gt;if you are a JavaScript or TypeScript Developer then you have probably used both NPM and NPX But what's actually the difference between both of them?&lt;/p&gt;

&lt;p&gt;Well, it turns out that NPX is actually a tool that gets included in NPM version 5.2 and later. So NPX is a tool that lives within NPM.&lt;/p&gt;

&lt;p&gt;NPM is Node Package Manager and these packages are just different node-related libraries or files and folders that get created by different developers out there Online, that we can use in our node or javaScript-based projects. So what that means is that NPM is what we use to coordinate and leverage these packages that we download, create react app is an example of that it's a tool that Facebook built for us to create a React app quickly and easily.&lt;/p&gt;

&lt;h1&gt;
  
  
  NPM
&lt;/h1&gt;

&lt;p&gt;We can do this with NPM and not only with NPX. NPM is an installation as well as a management environment. with NPM we can install and create react apps locally and globally, locally standing for the current folder that we are working on&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install create-react-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7TTbsbS9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmwfjhgyaiu0rishjifs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7TTbsbS9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmwfjhgyaiu0rishjifs.png" alt="Create react app" width="456" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;what this will do is install the Create React app locally within the current folder and anything inside the folder can leverage this Create React app.&lt;/p&gt;

&lt;p&gt;But if I wanted to use the Create React app across multiple folders and have only one version of it, Well it turns out that we can install it globally.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g create-react-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qqli_jBi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a9cjxoyms6trhx5qk9lf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qqli_jBi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a9cjxoyms6trhx5qk9lf.png" alt="create react app globally" width="469" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;so with this, we are simply installing the latest version of the React app. We used to do this before NPX&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Let's see NPM vs NPX using cowsay which is a package that draws out a cow that says whatever we pass into it.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;we will do &lt;code&gt;npm install -g cowsay&lt;/code&gt; and it will download the cowsay globally&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tfr-pq0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikr84blboy5s2avvlkc4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tfr-pq0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikr84blboy5s2avvlkc4.png" alt="npm install -g cowsay" width="541" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now i can do &lt;code&gt;cowsay hello&lt;/code&gt; and it will draw a cow with hello&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WDbWijA6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxs25nhmoug8h3zqhuro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WDbWijA6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxs25nhmoug8h3zqhuro.png" alt="cowsay hello" width="504" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if i want to check the location of the cowsay we can do is npm list cowsay this will give me the location of the installed package&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gsqehm-i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6mk26h4382c3frwjky0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gsqehm-i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6mk26h4382c3frwjky0.png" alt="npm list cowsay" width="599" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it will say empty because I have installed it globally and not only in the current folder. let's check the global location of the project by &lt;code&gt;npm list -g cowsay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x90qAwUD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qemmj31fzg268o6nij0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x90qAwUD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qemmj31fzg268o6nij0t.png" alt="npm list -g cowsay" width="546" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;with NPM we see that if we want to install a package we need to download it to the disk or hard drive of our computer this could be our local project folder or globally let us go ahead and uninstall the cowsay from our computer. &lt;code&gt;npm uninstall -g cowsay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pMDR-WY7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zaqv1mijdmvksr7q2041.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pMDR-WY7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zaqv1mijdmvksr7q2041.png" alt="npm uninstall -g cowsay" width="447" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  NPX
&lt;/h1&gt;

&lt;p&gt;we are gonna do &lt;code&gt;npx cowsay hello&lt;/code&gt; now if we run this we will see that it will first download it and it will execute it immediately&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ASkRHHRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgvpg4h48p5xzkqnyyz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ASkRHHRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgvpg4h48p5xzkqnyyz0.png" alt="npx cowsay hello" width="490" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;before npx we used to download it and then run it, what NPX does is that it directly installs the required files and it executes them immediately.&lt;/p&gt;

&lt;p&gt;now if I check for the cowsay package locally npm list cowsay it will give us empty as a result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4vqalGBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzxrhyub9pplrhz5wfnw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4vqalGBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzxrhyub9pplrhz5wfnw.png" alt="npm list cowsay" width="672" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;let us check for it globally it will again give us empty &lt;code&gt;npm list -g cowsay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IdBSbV9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z8jqiwpozfrbbanltqq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IdBSbV9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z8jqiwpozfrbbanltqq9.png" alt="npm list -g cowsay" width="549" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So what this means is that it downloads the latest package and executes it immediately then it deletes it from the disk. the main advantage of it is that we do not have to clog up or disk with all of these packages, so it all comes down to using it when it is needed.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Type Annotation vs Type Inference</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Sun, 07 Jan 2024 21:14:36 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/type-annotation-vs-type-inference-521j</link>
      <guid>https://dev.to/harshit_senpai/type-annotation-vs-type-inference-521j</guid>
      <description>&lt;p&gt;in the world of TypeScript, every assignable value has a type (as discussed in the last blog). Now to identify what type of a certain value has we have Type Annotations and Type Inferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣Type Annotations -
&lt;/h2&gt;

&lt;p&gt;Type Annotation at its core is just a small amount of code that we write to tell TypeScript what type of value a variable will refer to.&lt;br&gt;
So we developers tell typescript what types of values we are working with.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example of Type Annotations
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Type Annotation with variables&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numCars: number = 5;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so the &lt;code&gt;:number&lt;/code&gt; is our Type Annotation, now this tells typescript that we are only going to assign a type of number to numCars variable, and if we try to assign any other type we will quickly see an error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q1FeKf8t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ve8locrcy3veudki28bw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q1FeKf8t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ve8locrcy3veudki28bw.png" alt="example of Type Annotation for variables" width="592" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;more examples of Type Annotation with different types are :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let speed: string = 'fast';
let isSuperCar: boolean = false;
let sunroof: null = null;
let nothing: undefined = undefined;
const todayDate: Date = new Date();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2️⃣Type Inference -
&lt;/h2&gt;

&lt;p&gt;Type Inference just simply is a way in which typescript tries to find out what type a value is going to have.&lt;br&gt;
the general example of type inference with variables looks like this :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let isSuperCar = false;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;now if we try to assign a value that is not a boolean we will see an error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cqC056vj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr83hk266psqlnqm2d8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cqC056vj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr83hk266psqlnqm2d8g.png" alt="example of Type Inference with variables" width="658" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if we see in the error typescript has identified what type of value &lt;code&gt;isSuperCar&lt;/code&gt; has even though we have not told that typescript what type isSuperCar is going to have.&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣When to use Type Annotation and Type Inference -
&lt;/h2&gt;

&lt;h3&gt;
  
  
  When to use Type Annotation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
When we have a variable whose variable can't be inferred, suppose we have a variable which can either have a boolean or a number value.
In that case type inference will not be able to identify the type of variable on its own, the we need type inference an the syntax looks like this :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//A car can either have one sunroof or none

let sunroof: boolean | number = false;

//Now if we assign it a value of 1, we will not get an error 

sunroof = 1;

//It will not give an error as we have annotated that it is going to have either a boolean or a number as a value

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When we declare value on one line and initialize it later,&lt;br&gt;
earlier type inference worked because we had the declaration and initialization on the same line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When a function returns the 'any' type in that case we need to clarify the value beforehand.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to use type inference -
&lt;/h3&gt;

&lt;p&gt;Except for the above corner cases, we always try to rely on type inference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;In the next blog we will see more examples revolving around Type Annotation, Type Inference, and the corner cases&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is an OPTIONS Request in an API call?</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Sat, 06 Jan 2024 10:29:36 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/what-is-an-options-request-in-an-api-call-55dl</link>
      <guid>https://dev.to/harshit_senpai/what-is-an-options-request-in-an-api-call-55dl</guid>
      <description>&lt;h5&gt;
  
  
  If you are reading this blog then you must have come across the OPTIONS request in an API call, but what exactly is an Options Method
&lt;/h5&gt;

&lt;p&gt;well if you make a server request from the front end to the backend, and log the requests made to the server by using a logging package (in the Context of Nodejs) you will get a result like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OPTIONS /api/users/signup 204 2.247 ms - 0
POST /api/users/signup 201 519.913 ms - 333
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in this example, we are signing up the user, and the endpoint is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/api/users/signup&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we know what a POST method is but what is this OPTIONS method? &lt;/p&gt;

&lt;h1&gt;
  
  
  Let's break this down,
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;HTTP Method&lt;/strong&gt;: OPTIONS&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Endpoint&lt;/strong&gt;: /api/users/signup&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Status Code&lt;/strong&gt;: 204&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response Time&lt;/strong&gt;: 2.247 ms&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response Size&lt;/strong&gt;: - 0 (indicating a response with no content)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To put it in simple words an OPTIONS request is a part of the CORS (Cross-Origin Resource Sharing) mechanism.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The OPTIONS method is often used to request information about the communication options available for a target resource, including the permitted HTTP methods or the supported headers. It's part of the HTTP/1.1 protocol, and browsers often send OPTIONS requests as a pre-flight check before making a cross-origin request (e.g., for a POST request with certain headers).&lt;/p&gt;

&lt;h1&gt;
  
  
  in our current example :
&lt;/h1&gt;

&lt;p&gt;The client, typically a web browser, is checking what methods are allowed on the &lt;code&gt;/api/users/signup&lt;/code&gt; endpoint and what headers can be used in the actual request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Status Code (204):&lt;/strong&gt; This status code indicates that the server successfully processed the OPTIONS request, and there is no additional information to send in the response payload. thus the response is empty, as indicated by - 0.&lt;/p&gt;

&lt;h1&gt;
  
  
  In a nutshell:
&lt;/h1&gt;

&lt;p&gt;Browsers often perform this pre-flight request to determine if the actual request (e.g., a POST request) will be allowed by the server. The server responds with information about the allowed methods, headers, and other details. &lt;br&gt;
Thus HTTP OPTIONS request method is useful for determining what commands are available for use on a target server or for a specific resource.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What are Types in TypeScript</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Sat, 30 Dec 2023 21:15:31 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/what-are-types-in-typescript-pm4</link>
      <guid>https://dev.to/harshit_senpai/what-are-types-in-typescript-pm4</guid>
      <description>&lt;h2&gt;
  
  
  The Definition 🥸
&lt;/h2&gt;

&lt;p&gt;In TypeScript, Types are an easy way of to refer different properties and functions that a value has.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's break this sentence.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  what is a value 🤔 :
&lt;/h3&gt;

&lt;p&gt;Now, a value in TypeScript is anything that we can assign to a variable well we can assign numbers, strings, boolean, arrays, objects, and functions. all of these assignable entities have a type.&lt;/p&gt;

&lt;p&gt;for example, let's take "Red" we might say it is a string or alternatively we can say that this is a value that will have all the properties and methods we assume a string can have.&lt;/p&gt;

&lt;p&gt;Now a string has many functions and properties such as charAt(), concat(), and many more. length is one of the common property&lt;/p&gt;

&lt;p&gt;&lt;code&gt;console.log('Red'.length); // 3&lt;/code&gt;&lt;br&gt;
&lt;code&gt;console.log('Red'.chatAt(0)); // 'R'&lt;/code&gt;&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%2Fslde8iiae1gvq9jzf8f9.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%2Fslde8iiae1gvq9jzf8f9.png" alt="two ways to look at a value"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Now if we have to summerise "Red" by using all the properties and methods associated with it, that will be very inefficient.&lt;br&gt;
A shorter way to refer to a value is to assign it a type. In this example, you say the 'Red' is a string. Then, you know that you can use the properties and methods of a string for the value 'Red'&lt;/p&gt;

&lt;p&gt;thus Every value that we create has a type assigned to it, in some cases, it is very obvious such as the string in the example.&lt;/p&gt;

&lt;p&gt;in Conclusion,&lt;br&gt;
       a type is a label that describes the different properties &lt;br&gt;
       and methods that a value has&lt;/p&gt;

&lt;h2&gt;
  
  
  Categories of types
&lt;/h2&gt;

&lt;p&gt;Now in the world of TypeScript types are mainly characterised in 2 categories.&lt;/p&gt;

&lt;p&gt;. primitive type&lt;br&gt;
. Object type - Type that we build or are already built-in &lt;br&gt;
                TypeScript&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%2Fsm2im2exbs7jul1zdj35.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%2Fsm2im2exbs7jul1zdj35.png" alt="categories of types"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Need of Types ✨
&lt;/h2&gt;

&lt;p&gt;There are two main purposes of types in TypeScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Types are used by the TypeScript compiler to analyze your code for errors&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Types allow us to understand what values are associated with variables and what values are flowing around in our codebase&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2Fg8czi4u6y1xy8aqv64il.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%2Fg8czi4u6y1xy8aqv64il.png" alt="Need of Types"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example of Types in TypeScript 😎
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;const color = 'red';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The TypeScript compiler knows that the type of &lt;code&gt;color&lt;/code&gt; is &lt;code&gt;string&lt;/code&gt;&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%2Fahsn1nc9kamtjmx778th.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%2Fahsn1nc9kamtjmx778th.png" alt="example of type string"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And it shows a list of methods of the &lt;code&gt;string&lt;/code&gt; type that &lt;code&gt;color&lt;/code&gt;  can access:&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%2Fizljb56x3vsjfczy79ms.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%2Fizljb56x3vsjfczy79ms.png" alt="list of methods on string"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you try to access a property or method that doesn’t exist, the TypeScript compiler will show an error. For example:&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%2Fkbe76qrrgxk67aaabuez.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%2Fkbe76qrrgxk67aaabuez.png" alt="error for unknown property name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Every value in TypeScript has a type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A type is a label that describes the properties and methods that a value has.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TypeScript compiler uses types to analyze your code for hunting bugs and errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Open Source Contribution</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Sun, 06 Aug 2023 10:43:02 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/open-source-contribution-3l78</link>
      <guid>https://dev.to/harshit_senpai/open-source-contribution-3l78</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open Source lies the spirit of collaboration. Developers from diverse backgrounds come together to contribute their expertise, exchange ideas, and work towards common goals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The heart and soul of Open Source lies within its vibrant community. Developers, users, and enthusiasts come together in forums, conferences, and online platforms to share ideas and celebrate their achievements.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  why Contribute to Open Source?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Make a Positive Impact&lt;/li&gt;
&lt;li&gt;Collaborate with a Global Community&lt;/li&gt;
&lt;li&gt;Enhance Your Portfolio&lt;/li&gt;
&lt;li&gt;Strengthen the Ecosystem&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How to Contribute?
&lt;/h2&gt;

&lt;p&gt;You can make both Code and non-code contributions based on your field of interest&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Code Contribution&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can take various approaches while making a code contribution.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Issues&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;a. find/verify bugs&lt;br&gt;
b. suggest ideas&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Changes via PRs&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;a. fix bugs&lt;br&gt;
b. refactor code&lt;br&gt;
c. create features&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Reviewing Pull Requests&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;a. test changes&lt;br&gt;
b. make suggestions&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Non-code contributions&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Code is a very small part of Open Source, You can contribute to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;make suggestions&lt;/li&gt;
&lt;li&gt;make tutorials for beginners&lt;/li&gt;
&lt;li&gt;Spread awareness&lt;/li&gt;
&lt;li&gt;answer questions in the community&lt;/li&gt;
&lt;li&gt;Designing the User Interface&lt;/li&gt;
&lt;li&gt;Translating the language of the documentation&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Open Source is not limited to Code and non-code, You can start anytime and the best time is now.&lt;/p&gt;

&lt;h2&gt;
  
  
  See You Guys Next Time, Keep Building......
&lt;/h2&gt;

</description>
    </item>
    <item>
      <title>100 Days of Data Science and Machine Learning in Python : Day 0</title>
      <dc:creator>harshit mishra </dc:creator>
      <pubDate>Fri, 24 Mar 2023 18:56:25 +0000</pubDate>
      <link>https://dev.to/harshit_senpai/100-days-of-data-science-and-machine-learning-in-python-day-0-5ffl</link>
      <guid>https://dev.to/harshit_senpai/100-days-of-data-science-and-machine-learning-in-python-day-0-5ffl</guid>
      <description>&lt;h2&gt;
  
  
  &lt;em&gt;&lt;strong&gt;"Success isn't always about greatness. It's about consistency. Consistent hard work leads to success. Greatness will come."&lt;/strong&gt;&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;*&lt;em&gt;100 Days of code is a popular challenge in the developer community where you have to code consistently for 100 days and make some documentation about it.  *&lt;/em&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Well hello, everyone I am really excited to start this 100-day of code challenge where I will be learning Data Science and Machine Learning and building some awesome projects along this 100-day of journey 🤩. &lt;/p&gt;

&lt;p&gt;I will be sharing what I learned each day and sharing my point of view on the topics I learned. Also, I will be sharing my code samples and resources so that you guys can use these blogs as documentation for your journey🚀.&lt;/p&gt;

&lt;p&gt;Peace Out ✌.&lt;/p&gt;

&lt;p&gt;follow me: &lt;br&gt;
&lt;a href="https://www.linkedin.com/in/harshit-mishra-60483b231/"&gt;https://www.linkedin.com/in/harshit-mishra-60483b231/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/Harshit_senpai"&gt;https://twitter.com/Harshit_senpai&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ken-senpai.hashnode.dev/"&gt;https://ken-senpai.hashnode.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.instagram.com/harshit__senpai/"&gt;https://www.instagram.com/harshit__senpai/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@miharshit2"&gt;https://medium.com/@miharshit2&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
