<?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: Hector Osuna</title>
    <description>The latest articles on DEV Community by Hector Osuna (@fangoh).</description>
    <link>https://dev.to/fangoh</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%2F568569%2F6ec25625-7edd-4274-9a78-c1084fbd7e86.jpeg</url>
      <title>DEV Community: Hector Osuna</title>
      <link>https://dev.to/fangoh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fangoh"/>
    <language>en</language>
    <item>
      <title>Vanilla Use Reducer with TypeScript</title>
      <dc:creator>Hector Osuna</dc:creator>
      <pubDate>Wed, 16 Jun 2021 20:11:22 +0000</pubDate>
      <link>https://dev.to/fangoh/vanilla-use-reducer-with-typescript-4f9p</link>
      <guid>https://dev.to/fangoh/vanilla-use-reducer-with-typescript-4f9p</guid>
      <description>&lt;p&gt;Hi, I was recently doing a project for my portfolio, a React Project with a slightly complex state. Personally, I really love TypeScript and the Redux/Reducer patterns, because they give me a great Developer Experience with TypeScript and a lot of autocompletion available, quite useful in order to not get bit by a bug caused by a typo, and really convenient as I don't have to explore files constantly in order to know what are the properties that a certain object &lt;em&gt;should&lt;/em&gt; have.&lt;/p&gt;

&lt;p&gt;I always prefer to use TS over vanilla JS, so, it makes a lot of sense to try to make use of strict typing, even in a concept app. Also, while vanilla useReducer might not be what most projects use, I still want to share how I found it to be pretty useful in this context.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;My application is a Social Media-like platform, so a very important part is the use of a &lt;strong&gt;user&lt;/strong&gt;, whose information lives in the global state, that I'm going to access constantly for making requests to the server and other stuff. In order to keep my Client-Side code tidy and predictable, I built a state into a &lt;code&gt;UserReducer&lt;/code&gt; which is going to store the user info and make changes, this is then exposed in an almost global context in order to be accessible anywhere in the frontend.&lt;/p&gt;

&lt;p&gt;So, my goals in typing the Reducer, are quite simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get better intellisense whenever I need to dispatch an action.&lt;/li&gt;
&lt;li&gt;Make quite simple the construction of an &lt;code&gt;Action Creator&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Having appropriate intellisense in the &lt;code&gt;action.payload&lt;/code&gt; inside the reducer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Typing the state
&lt;/h3&gt;

&lt;p&gt;More often than not, the initial state isn't going to be a great example of how the &lt;em&gt;usual&lt;/em&gt; state will look like, so it's pretty important to declare a State Type, in my particular use case, I'm going to propose the following typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;UserState&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;isLogged&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="nl"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&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;I must type userID and username as string or null, as null it's my default state whenever I have no user. However, it's pretty important to type it as string, If I were to not define this interface, useReducer would infer my State type from the following initial state&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;isLogged&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// typeof initialState = {&lt;/span&gt;
&lt;span class="c1"&gt;//  isLogged: boolean;&lt;/span&gt;
&lt;span class="c1"&gt;//  userID: never;&lt;/span&gt;
&lt;span class="c1"&gt;//  username: never;&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;And would make the TS compiler complain whenever I try to set a valid &lt;code&gt;userID&lt;/code&gt; as a &lt;code&gt;string&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Typing the actions
&lt;/h3&gt;

&lt;p&gt;The first step in order for this to be successful, is to type adequately all the actions that the reducer might consume. This is pretty important, as using string literals (specifically in &lt;code&gt;action.type&lt;/code&gt;) will help the TS to narrow down the needed payload. In the end, it's only a matter of making a union type between the individual interfaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;UserLoginAction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGIN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;yourPayload&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;UserLogoutAction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGOUT&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="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;UserReducerAction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;UserLoginAction&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;UserLogoutAction&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Writing the reducer
&lt;/h3&gt;

&lt;p&gt;The last part of making this cohesive, is to correctly type the reducer function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userReducer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="c1"&gt;// initialState must be explicitly typed as UserState, &lt;/span&gt;
    &lt;span class="c1"&gt;// in order to state be correctly typed&lt;/span&gt;
    &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;UserReducerAction&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;UserState&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// We get nice intellisense in the case statement too, &lt;/span&gt;
        &lt;span class="c1"&gt;// which shows us an error if we don't type the type correctly&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;// Action gets typed as a UserLoginAction type, &lt;/span&gt;
        &lt;span class="c1"&gt;// which helps us having the appropriate payload&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;isLogged&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logout&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;// trying to use action.payload will result in an error&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;isLogged&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="nl"&gt;default&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;state&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;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;And there it is, now we have a correctly typed useReducer pattern, which can be extended to, maybe creating Action Creators, or whatever you may like.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>react</category>
    </item>
    <item>
      <title>First Steps on the research of Web Hosting</title>
      <dc:creator>Hector Osuna</dc:creator>
      <pubDate>Thu, 10 Jun 2021 22:33:07 +0000</pubDate>
      <link>https://dev.to/fangoh/first-steps-on-the-research-of-web-hosting-4jia</link>
      <guid>https://dev.to/fangoh/first-steps-on-the-research-of-web-hosting-4jia</guid>
      <description>&lt;p&gt;One of the more daunting thing of developing, is to get to know &lt;em&gt;how&lt;/em&gt; to deploy, as it's almost guaranteed that you will incur in some kind of cost, so before doing the big jump to trying a VPS (as a service), I decided to make a local Virtual Server to do some testing in setting up server environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  A what?
&lt;/h3&gt;

&lt;p&gt;Well, to give a little explanation of what I was doing, I need to explain how to web works.&lt;/p&gt;

&lt;p&gt;Now and then I have been mentioning about Front-end and Back-end, in some way, you can rename both to Client-Side and Server-Side. The Client is often you, the end-user, whoever visits the web app or webpage, technically the client-side code is executed by the browser and do whatever needs to be done. Typically, it means to &lt;em&gt;fetch&lt;/em&gt;, display, and update data.&lt;/p&gt;

&lt;p&gt;Think of Facebook, for example, the posts, user info, comments, pages are the data, clients can see it, interact with it, update the info, and all kind of different tasks. This data is stored in wherever Facebook &lt;strong&gt;servers&lt;/strong&gt; are, The Servers are a crucial part in web apps development, as it allows the client to not receive all the data on start, brings authentication and security in place, and allows for interaction between users in an efficient and secure way.&lt;/p&gt;

&lt;p&gt;Personally, I have seen a lot the analogy of a restaurant, The customers are clients, that in a way, do something with the resources of the restaurant, but they have to be &lt;em&gt;manipulated&lt;/em&gt; (in a no-negative way) before they are consumed by the end users. Ingredients could be understood as the raw data, either from a database, public API, or collected on the go, while these are cooked (prepared) by the chefs (the server), then the waiters deliver whatever gets out of the kitchen to the customers (the client).&lt;/p&gt;

&lt;p&gt;Obviously, I think this is a great oversimplification for a lot of parts, but you get the idea. Whenever I develop something, I usually feel pretty comfortable setting my local development environment, one port of my laptop to get the server code running, connecting to a local database on another port, and a client server on another (usually liveserver or webpack). But, I started asking the questions, when I get to deploy full web apps, how I should go around hosting?, so far in my journey, I only needed to host static (front end) sites, so I got to get away with netlify, github pages, etc, with only one exception, a Wordpress page I needed to get done, however, to this day, I don't know where is hosted, so I don't worry too much about it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some types of hosting
&lt;/h3&gt;

&lt;p&gt;There are quite a lot options you can go around with hosting, which, If I am completely honest, it gets &lt;strong&gt;really&lt;/strong&gt; overwhelming. In a simple way, your application NEEDS to be running in &lt;em&gt;a computer&lt;/em&gt; somewhere in the internet, so hosting is mostly about deciding how and where your application will live. &lt;/p&gt;

&lt;p&gt;You could use a &lt;em&gt;Shared Hosting&lt;/em&gt;, which basically means that there are a bunch of applications living within the same computer, the number can't be determined as it varies with the amount of resources that the host has, there are clearly downsides of this, such as the CPU and memory never being guaranteed for you, and lack of configuration options, since the machine HAS to support multiple apps. On upsides, it can get REALLY cheap.&lt;/p&gt;

&lt;p&gt;You could instead prefer a &lt;em&gt;Virtual Machine&lt;/em&gt;, which basically is an emulator of another computer within a Host machine (a real computer),  this reduces a lot of the downsides of shared hosting, as you basically rent &lt;em&gt;a computer&lt;/em&gt; with dedicated resources, ability to configure it however you like. HOWEVER, it has downsides too, as it becomes a little pricier (and can get expensive pretty fast), and the most daunting part, unless you are willing to pay extra for someone to setup, maintain, secure and deploy, you will have to do it yourself, and if you haven't touched a Linux OS (while technically Windows CLI works too, it's not a popular choice), it gets pretty weird.&lt;/p&gt;

&lt;p&gt;Another option would be to rent a physical server for yourself, but to be honest, unless I find myself working in a very big company, I don't see me setting something like that anytime soon (although, a dream of mine is to set my own server in my house), it has expanded benefits over virtual machines, but it also gets VERY expensive, which I find understandable, but I have no way/interest of exploring it further to say much else.&lt;/p&gt;

&lt;p&gt;Sure, I am getting over some other options, like Heroku and other PaaS (Platform as a Service), but, they are quite straightforward to set up and for the most part, you are limited to paying for more things in the setup (like the database, or other services), so they are most likely not the most cost-effective solution. &lt;/p&gt;

&lt;p&gt;So, after thinking a while, that If I wanted to give confidence, and not raise expenses of projects just in ¿irresponsible? hosting, I decided that I wanted to learn how to setup a VPS (virtual private server), however, to be really honest, I am generally scared of things that &lt;em&gt;could&lt;/em&gt; incur in a cost, which it gets worse with the generally non-transparent pricing on cloud services (like Amazon Web Services, for example), so I searched for an alternative to ¿locally test? a production server environment.&lt;/p&gt;

&lt;p&gt;Just like that, along with getting to know and develop some projects, I added a tiny bit of DevOps to my to-learn list. This week has been pretty fun learning to set up Node Apps on Ubuntu-Server plus Nginx, I still have a lot to learn (like Docker, Vagrant and other tools), but, I think I will get there, pretty sure that it's not going to be soon, but someday I'll be able to be more confident on it.&lt;/p&gt;

&lt;p&gt;To be honest, I wanted to write a little about the setup process, but this post has already become too long to my taste. So, If you want to keep up, you should definitely follow me here, or on &lt;a href="https://twitter.com/DevFanGoH"&gt;twitter&lt;/a&gt; or visit my site: &lt;a href="//fangoh.dev"&gt;fangoh.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>heroku</category>
      <category>linux</category>
    </item>
    <item>
      <title>The first Open Source contribution, a beginner perspective</title>
      <dc:creator>Hector Osuna</dc:creator>
      <pubDate>Sat, 06 Feb 2021 06:09:59 +0000</pubDate>
      <link>https://dev.to/fangoh/the-first-open-source-contribution-a-beginner-perspective-52a1</link>
      <guid>https://dev.to/fangoh/the-first-open-source-contribution-a-beginner-perspective-52a1</guid>
      <description>&lt;p&gt;Developers are no strangers to using open source code, it's something normal. As a beginner, it's natural to think that the people behind it have years of experience doing so, I certainly did. If you asked me last week I wouldn't never imagined that I would make my first successful PR. But hey, here we are.&lt;/p&gt;

&lt;h2&gt;
  
  
  The motive
&lt;/h2&gt;

&lt;p&gt;My journey began a few days ago when I wanted to learn the gist of JSON Web Tokens for user authentication, but didn't felt like messing with an existing project. So I decided to set up a quick server using Express with Typescript, after all, this practice was meant for one and one purpose only (Oh boy, I was wrong).&lt;/p&gt;

&lt;p&gt;Problems arised when I decided that I needed Browser Hot Reload, and since I wanted to do Vanilla FrontEnd, I wouldn't set up a tool like webpack. So I decided to go with a lightweight solution, the &lt;a href="https://www.npmjs.com/package/livereload"&gt;node-liverload&lt;/a&gt; package, it gets the job done, but since it isn't as popular as a dedicated bundler I couldn't find a &lt;code&gt;.d.ts&lt;/code&gt; file anywhere, as a result, the TS Compiler wasn't very happy about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The determination
&lt;/h2&gt;

&lt;p&gt;After Googling for a bit, I found the &lt;em&gt;usual way&lt;/em&gt; to solve the problem, create a local directory to store custom declaration files for existing npm packages. To be honest, that solution would have been enough for my use case, since &lt;code&gt;livereload&lt;/code&gt; &lt;em&gt;normal usage&lt;/em&gt; requires only 2 lines of code in the &lt;code&gt;app.js&lt;/code&gt; file. However, I have been playing with TS for a bit, so it was natural to wonder &lt;em&gt;Wouldn't be nice to have an &lt;code&gt;npm install @types/livereload&lt;/code&gt;?&lt;/em&gt; (little spoiler, it's available now).&lt;/p&gt;

&lt;p&gt;I thought that maybe I would want to use livereload with TS again in the future, and it wouldn't be practical to redo the declaration file, or maybe I was getting ambitious with TS and wanted the &lt;em&gt;full&lt;/em&gt; intellisense  on the methods. Whatever the case was, I must admit that I was inspired by &lt;a href="http://blog.wolksoftware.com/contributing-to-definitelytyped"&gt;this article&lt;/a&gt; about the process of contribuiting to &lt;a href="https://github.com/DefinitelyTyped/DefinitelyTyped"&gt;DefinitelyTyped&lt;/a&gt;. &lt;em&gt;It can't be that difficult, right?&lt;/em&gt; (For once, I was right here).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gytKifob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lfdo2851m5q7g515hdoc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gytKifob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lfdo2851m5q7g515hdoc.jpg" alt="Open Source Is about working as a team"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;span&gt;Photo by &lt;a href="https://unsplash.com/@hannahbusing?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Hannah Busing&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/teamwork?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;
&lt;h2&gt;
  
  
  The process
&lt;/h2&gt;

&lt;p&gt;Specifically for adding a type for Definitely Typed, the task needed pretty much these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write the required file.&lt;/li&gt;
&lt;li&gt;Test.&lt;/li&gt;
&lt;li&gt;Make sure you follow the guidelines.&lt;/li&gt;
&lt;li&gt;Open the Pull Request.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Write the required file.
&lt;/h4&gt;

&lt;p&gt;This part is pretty interesting, I feel pretty much like a beginner in the whole WebDev ecosystem, I had never worked before &lt;em&gt;on&lt;/em&gt; someone else's code, as a result, &lt;em&gt;at first&lt;/em&gt; it felt pretty daunting &lt;em&gt;What if I'm not ready?&lt;/em&gt;, well you got to start somewhere. &lt;/p&gt;

&lt;p&gt;In order to make useful Type Definitions, I had to dive in livereload source code, which is written in CoffeeScript (I haven't had the pleasure to learn it neither), therefore, I spent some quality time re-writting it in TypeScript in order to make the appropiate parameters and such.&lt;/p&gt;

&lt;p&gt;During this quality time, I learned 3 very importante things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How the library works (pretty interesting stuff, to be honest)&lt;/li&gt;
&lt;li&gt;The importance of writing good, clean code (I'm very grateful to the author)&lt;/li&gt;
&lt;li&gt;Coding anything is like building Legos, with the difference that the pieces are huge, and more often than not, you find yourself within a very big community (More on this later).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Test your files
&lt;/h4&gt;

&lt;p&gt;Definitely Typed (DT) (and most if not all open source repos), has a solid guideline in order to make the repo mantainable. One of the principles to make a Pull Request, is to write the appropiate test files and pass them with their configuration.&lt;/p&gt;

&lt;p&gt;Specifically in this case, the test is a file that uses the interface/type that you worked on, the suggested way to do this, is to adapt the original library example code to TS, if the compiler finds no problems with it, then you are good to go. I want to notice, that DT have a specific linter for their packages, so some things that would normally run without issues with TSC, don't work here.&lt;/p&gt;

&lt;p&gt;As a solo-developer for the last year, I could see that tests may seem something that we could overlook, however, if someone where to modify one file to add functionality, tests are an amazing way to verify if a bug or some breaking changes where made, in order to fix them. In this case, tests where required, but I have seen a lot of pull requests being delayed in order to request tests.&lt;/p&gt;

&lt;h4&gt;
  
  
  Make sure you follow the guidelines
&lt;/h4&gt;

&lt;p&gt;The main point of this part, is that you will definitely need to address all the guidelines of the specific project you want to work on, that's normal, and it may seem daunting at first, however, stricter requirements usually have very clear instructions.&lt;/p&gt;

&lt;p&gt;In DT, the packages &lt;em&gt;must&lt;/em&gt; have a &lt;code&gt;tsconfig.json&lt;/code&gt;, a &lt;code&gt;tslint.json&lt;/code&gt; with the appropiate configuration, otherwise, the PR's aren't merged. Luckily, a tool is given to help with this part.&lt;/p&gt;

&lt;h4&gt;
  
  
  Open the Pull Request
&lt;/h4&gt;

&lt;p&gt;This is possibly the most nerve-wracking part, I can't exactly pinpoint why. Maybe is the feeling of exposing your code to the world to see, as an aspiring Full Stack Developer, I'm used to show what my code &lt;em&gt;can do&lt;/em&gt;, not what my code &lt;em&gt;is&lt;/em&gt;, it could be the feeling that I am a rookie who it's about to be judged by the pros. &lt;/p&gt;

&lt;p&gt;Whatever it is, I also became more and more excited while this was happening. My first reviewer was a bot, it automates a lot of parts of the process and makes the merging process even more seamless (Definitely Typed contains definitions for about 6000+ packages, it's natural to have a bot there).&lt;/p&gt;

&lt;p&gt;Before I realized, the PR tests passed, and a mantainer gave my package the green flag, so, in a couple of hours I received this notification:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4YT57qek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gldv3r7qux5dpcvtdiuy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4YT57qek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gldv3r7qux5dpcvtdiuy.PNG" alt="The package went live on npm"&gt;&lt;/a&gt;&lt;em&gt;Yay, I did it!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;Never it's to early to give open source a try, this is a small contribution, but I believe that it could help a fellow developer (maybe myself) in the near future. After all, open source is about little building blocks to make great things. &lt;/p&gt;

&lt;p&gt;Now I have the confidence to dive in other people source codes, they won't eat me. This kind of collaboration is a great experience that I definitely recommend and expect to live again in the near future. &lt;/p&gt;

&lt;p&gt;Consider following me on &lt;a href="https://twitter.com/FanGoH25"&gt;Twitter&lt;/a&gt;, I try to share a little bit of my coding adventure there.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>typescript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
