Difference between revisions of "TypeScript"

From Power Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
== Backward compatibility ==
 
== Backward compatibility ==
  
In the end, TypeScript has to be transpiled/compiled to JavaScript. This could, for example, be done via the “tsc” command, which will transpile the TS file to the configured target ECMAScript version (ECMAScript is a standard to define JavaScript. You can read more about that here as well as about the browser support here). With the ability to target different/older versions of the standard the TS will get automatically transpiled into a JS file that is compatible with older browser versions. This means one can write readable code without thinking about compatibility. When transpiled it gets something that is compatible. Of course, it’s not always that easy. In the screenshot below you can see a part of our transpiled demo file.
+
In the end, TypeScript has to be transpiled/compiled to JavaScript. This could, for example, be done via the “tsc” command, which will transpile the TS file to the configured target ECMAScript version (ECMAScript is a standard to define JavaScript. You can read more about that [https://www.w3schools.com/Js/js_versions.asp here] as well as about the browser support [http://kangax.github.io/compat-table/es6/ here]). With the ability to target different/older versions of the standard the TS will get automatically transpiled into a JS file that is compatible with older browser versions. This means one can write readable code without thinking about compatibility. When transpiled it gets something that is compatible. Of course, it’s not always that easy. In the screenshot below you can see a part of our transpiled demo file.
  
 
== Tests & Debugging ==
 
== Tests & Debugging ==
Line 14: Line 14:
  
 
== Community Content ==
 
== Community Content ==
* [https://learn.develop1.net/courses/building-javascript-web-resources-using-typescript Free Course on TypeSCript] by Scott Durow
+
* [https://learn.develop1.net/courses/building-javascript-web-resources-using-typescript Free Course on TypeScript] by Scott Durow
 +
* [https://www.youtube.com/playlist?list=PLqJfvq4Fy1P5Q5l19fFUTS3QchwsmdxPZ YouTube Playlist of TypeScript for Dataverse Mentoring Program] by Danish Naglekar
 
* [https://develop1.net/public/post/2018/06/09/Lets-start-TypeScript-Part-1 Let’s start TypeScript – Part 1] by Scott Durow
 
* [https://develop1.net/public/post/2018/06/09/Lets-start-TypeScript-Part-1 Let’s start TypeScript – Part 1] by Scott Durow
 
* [https://www.oliverflint.co.uk/2020/03/07/D365-Typescript-Webresources-Part-1/ D365 TypeScript Web Resources - Part 1 - Basics] by Oliver Flint
 
* [https://www.oliverflint.co.uk/2020/03/07/D365-Typescript-Webresources-Part-1/ D365 TypeScript Web Resources - Part 1 - Basics] by Oliver Flint
 
* [https://benediktbergmann.eu/2020/11/01/how-to-call-xrm-webapi-using-typescript/ Setting up a TypeScript project for Dataverse] by Benedikt Bergmann
 
* [https://benediktbergmann.eu/2020/11/01/how-to-call-xrm-webapi-using-typescript/ Setting up a TypeScript project for Dataverse] by Benedikt Bergmann
 +
 +
[[Category:Developer]]

Latest revision as of 08:04, 7 December 2021

TypeScript is a superset of JavaScript. It is strongly typed and makes development much easier.

Strongly typed

Since TypeScript is strongly typed the job of writing it gets a lot easier. If you use a proper IDE (Visual Studio Code for example) it will show you type errors while developing.

Backward compatibility

In the end, TypeScript has to be transpiled/compiled to JavaScript. This could, for example, be done via the “tsc” command, which will transpile the TS file to the configured target ECMAScript version (ECMAScript is a standard to define JavaScript. You can read more about that here as well as about the browser support here). With the ability to target different/older versions of the standard the TS will get automatically transpiled into a JS file that is compatible with older browser versions. This means one can write readable code without thinking about compatibility. When transpiled it gets something that is compatible. Of course, it’s not always that easy. In the screenshot below you can see a part of our transpiled demo file.

Tests & Debugging

With TypeScript it is much easier to create tests that could be run automatically in a pipeline. Another big plus is that it is possible to debug the code with the help of source map files.

Community Content