<?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: Daniel M. Matongo</title>
    <description>The latest articles on DEV Community by Daniel M. Matongo (@mmatongo).</description>
    <link>https://dev.to/mmatongo</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%2F175877%2Fda3442a9-4527-498a-9d61-5d908db50381.png</url>
      <title>DEV Community: Daniel M. Matongo</title>
      <link>https://dev.to/mmatongo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mmatongo"/>
    <language>en</language>
    <item>
      <title>What is TypeScript</title>
      <dc:creator>Daniel M. Matongo</dc:creator>
      <pubDate>Fri, 18 Mar 2022 11:19:31 +0000</pubDate>
      <link>https://dev.to/mmatongo/what-is-typescript-3fop</link>
      <guid>https://dev.to/mmatongo/what-is-typescript-3fop</guid>
      <description>&lt;p&gt;TypeScript, as its name suggests, is a typed superset of JavaScript, which means that all JavaScript code is valid in TypeScript – making it very easy to get started. In addition, TypeScript has several language features including static typing, most ES6 syntax, and object-oriented programming constructs. It is a compiled language, which means you’ll have to transpile it to JavaScript before it can be run.&lt;/p&gt;

&lt;p&gt;TypeScript's main mission is simple: make JavaScript, which is a dynamically typed language, behave more like a statically typed language.&lt;/p&gt;

&lt;p&gt;But whats the difference between dynamic and static typing?&lt;/p&gt;

&lt;h3&gt;
  
  
  Basics
&lt;/h3&gt;

&lt;p&gt;Every feature provided in TypeScript is non-invading, meaning that it has syntax that doesn't overlap with any part of the JS code. This makes porting your JS app back and forth relatively easily.&lt;/p&gt;

&lt;p&gt;You can specify your variable's type using the colon (:) followed by the actual name of the type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stringVar&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;str&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are 6 basic, primitive types to remember:&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;number&lt;/span&gt; &lt;span class="c1"&gt;// represents any kind of numeric value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="c1"&gt;// represents any kind of string value;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="c1"&gt;// represents any boolean value, i.e. true or false;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;symbol&lt;/span&gt; &lt;span class="c1"&gt;// represents symbol values;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="c1"&gt;// represents null value only;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="c1"&gt;//represents undefined value only;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What does TypeScript offer ?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Static Type Checking (Optional) – Like other high level programming languages like Java, C etc. TypeScript does provide static type checking unlike JavaScript. Although static typing requires some extra steps while writing code but it has its own advantages. With TypeScript, we can check and assign variables, parameters and function types. It is completely Optional and helps us find and prevent bugs. Also helps make code more readable and descriptive.&lt;/li&gt;
&lt;li&gt;Class Based Objects – Another huge advantage is the use of Classes which provides the ability to use true object oriented programming in our applications and prevents use of prototype based objects. It also provides encapsulation, inheritance and modifiers.&lt;/li&gt;
&lt;li&gt;Modularity – It helps make the code more modular.&lt;/li&gt;
&lt;li&gt;ES6 Features – Support for ES6 features is also one of the main reasons for its popularity.&lt;/li&gt;
&lt;li&gt;Syntax – TypeScript provides syntax which is closer to java and other high level languages (Syntactical Sugaring).&lt;/li&gt;
&lt;/ul&gt;

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