{"id":7268,"date":"2022-03-04T07:28:09","date_gmt":"2022-03-04T06:28:09","guid":{"rendered":"https:\/\/immune.institute\/?p=7268"},"modified":"2022-03-04T07:28:09","modified_gmt":"2022-03-04T06:28:09","slug":"typescript-que-es-como-se-diferencia-javascript","status":"publish","type":"post","link":"https:\/\/immune.institute\/en\/blog\/typescript-que-es-como-se-diferencia-javascript\/","title":{"rendered":"TypeScript, what is it and how does it differ from JavaScript?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Increasingly, companies are opting for programming languages whose code is scalable, simple and clean. One of the clearest examples is TypeScript which, in just a few years, has become a firm favourite.<\/span><\/p>\n<blockquote>\n<p style=\"text-align: center;\"><span style=\"font-weight: 400;\">TypeScript (TS) is considered a higher level programming language, as it has many advantages for web development and the improvement of the <\/span><a href=\"https:\/\/immune.institute\/en\/blog\/experiencia-usuario-influencia-proceso-compra\/\"><span style=\"font-weight: 400;\">user experience<\/span><\/a><span style=\"font-weight: 400;\"> in apps and websites.<\/span><\/p>\n<\/blockquote>\n<p><b>TypeScript is a superset of the famous JavaScript<\/b><span style=\"font-weight: 400;\">It is a language that translates the code of this language and, in addition, it has other improvements. In this post, we take a closer look at TypeScript, what it is and how it differs from JavaScript.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">What is TypeScript?<\/span><\/h2>\n<blockquote>\n<p style=\"text-align: center;\"><span style=\"font-weight: 400;\">Designed by Microsoft in 2012, TypeScript stands out for its versatility; it is also simpler and easier to test, as it allows code to be written with fewer errors. As such, it is the default language that Google uses for Angular development.<\/span><\/p>\n<\/blockquote>\n<p><b>TypeScript is an object-oriented language<\/b><span style=\"font-weight: 400;\"> (such as the <\/span><a href=\"https:\/\/immune.institute\/en\/lenguaje-de-programacion-r\/\"><span style=\"font-weight: 400;\">R language<\/span><\/a><span style=\"font-weight: 400;\">for example). This means that both the client and the server have access to write code. In addition, it is open source.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the other hand, it stands out for being cross-platform and therefore portable. That is to say, <\/span><b>can be used from any device, operating system or browser<\/b><span style=\"font-weight: 400;\">. Like JavaScript, it does not require any specific machine.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In fact, these are not the only characteristics shared by these 2 <\/span><a href=\"https:\/\/immune.institute\/en\/lenguajes-de-programacion-para-movil\/\"><span style=\"font-weight: 400;\">programming languages<\/span><\/a><span style=\"font-weight: 400;\">:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>The usage is similar to JavaScript:<\/b><span style=\"font-weight: 400;\"> As TypeScript is based on JavaScript, it is easy to understand, if you already know JavaScript.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>JavaScript libraries can be incorporated:<\/b><span style=\"font-weight: 400;\"> TypeScript supports JavaScript libraries. In fact, developers can also use the same JavaScript frameworks and tools.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>JavaScript is TypeScript: <\/b><span style=\"font-weight: 400;\">If the extension is changed from .js to .ts, the code written in JavaScript becomes TypeScript.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>TypeScript code is converted to JavaScript: <\/b><span style=\"font-weight: 400;\">It should be noted that TypeScript code is not understood by browsers at first. It is therefore necessary to compile it and convert it into JavaScript code. A 'computer translation' that is known as 'trans-piled' or, in English, 'transpilation'.<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400;\">Why use TypeScript?<\/span><\/h3>\n<p><b>TypeScript is characterised by handling different types of data.<\/b><span style=\"font-weight: 400;\"> It is therefore a scalable and secure language, because the execution of its code can be verified.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Whereas with JavaScript, the data type could not be known until the moment of execution (which leads to errors); TypeScript is a static language, so there is a division of data types.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are 3 categories of TypeScript data types:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Any:<\/b><span style=\"font-weight: 400;\"> This means that a variable can be any type of data.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Integrated: <\/b><span style=\"font-weight: 400;\">In this sense, we see the variables number, boolean, string, null, void and undefined.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>User-defined:<\/b><span style=\"font-weight: 400;\"> This includes enumeration, array, interface, tuple and class.<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400;\">TypeScript Tutorial: advantages of using this programming language<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">So why use TypeScript and what are the benefits of using this programming language?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here are the advantages of TypeScript:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>An intuitive language: <\/b><span style=\"font-weight: 400;\">TypeScript is an easy language to learn, if you know JavaScript. It is also an easy language to read and write.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Detects errors in time:<\/b><span style=\"font-weight: 400;\"> TypeScript's precision is ideal. It allows compilation errors to be detected before execution, so it is reliable code with a very low error rate.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>It facilitates teamwork:<\/b><span style=\"font-weight: 400;\"> Being cross-platform, several developers can work on the same project in unison.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Generates standard code:<\/b><span style=\"font-weight: 400;\"> This is also conducive to reducing potential problems.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Static writing:<\/b><span style=\"font-weight: 400;\"> It is not dynamic code, so this type of writing favours improved code structure and object-oriented programming techniques.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Effectiveness:<\/b><span style=\"font-weight: 400;\"> JavaScript skills can be used more effectively. Compiled TypeScript, it becomes a safer and cleaner JavaScript.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">But what is TypeScript and how does it differ from JavaScript? Still not clear?<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">TypeScript VS JavaScript: how do they differ?<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Now it's time to find out what TypeScript is and how it differs from JavaScript. Here are the most obvious differences:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">TypeScript is statically typed, whereas JavaScript is a dynamic language.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">JavaScript does not support modules, whereas TypeScript does.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">TypeScript has an interface, whereas JavaScript does not.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In TypeScript you do have to compile the code, in JavaScript you don't have to.<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400;\">Discover how to learn TypeScript at our technology institute\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">If you already know what TypeScript is and how it differs from JavaScript, it's time to start learning it!<\/span><\/p>\n<p><b>Discover in IMMUNE all our amazing training offer<\/b><span style=\"font-weight: 400;\"> and dedicate yourself to what you like the most. We have very complete programmes for you to become the best web developer. Don't miss our <\/span><a href=\"https:\/\/immune.institute\/en\/programas\/grado-en-ingenieria-de-desarrollo-de-software\/\"><span style=\"font-weight: 400;\">Degree in Software Development Engineering<\/span><\/a><span style=\"font-weight: 400;\">as well as other formations such as our <\/span><a href=\"https:\/\/immune.institute\/en\/programas\/bootcamp-desarrollo-web\/\"><span style=\"font-weight: 400;\">Web Development Bootcamp<\/span><\/a><span style=\"font-weight: 400;\">.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">And if you don't have much time, you can start with this <\/span><a href=\"https:\/\/immune.institute\/en\/programas\/diploma-programacion-en-python\/\"><span style=\"font-weight: 400;\">Free Python Course<\/span><\/a><span style=\"font-weight: 400;\">!\u00a0<\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>Cada vez m\u00e1s, las compa\u00f1\u00edas optan por lenguajes de programaci\u00f3n, cuyo c\u00f3digo sea escalable, sencillo y limpio. Uno de los ejemplos m\u00e1s claros es TypeScript que, en tan solo unos pocos a\u00f1os, se ha convertido en toda una apuesta firme. TypeScript (TS) es considerado un lenguaje de programaci\u00f3n de nivel superior, ya que dispone de [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":7441,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-7268","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/posts\/7268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/comments?post=7268"}],"version-history":[{"count":0,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/posts\/7268\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/media\/7441"}],"wp:attachment":[{"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/media?parent=7268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/categories?post=7268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/immune.institute\/en\/wp-json\/wp\/v2\/tags?post=7268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}