#JavaScript through #TypeScript

#JavaScript through #TypeScript

#JavaScript code which has the .js file extension is of paramount importance if you wish to learn #TypeScript, luckily the basics will suffice, like what are Variable and Arrays, how is a Function created and what constitutes an Object. TypeScript code which has the .ts file extension is actually JavaScript code extended with Type information, either inferred by TypeScript or explicitly stated within the code. Furthermore TypeScript actually #transpiles or converts at #runtime into the most browser compatible JavaScript, ensuring your code works everywhere as intended. The advantage of using TypeScript is that it catches errors during development, especially when all types are explicitly defined. In addition, it can also use newer JavaScript version features that some browsers do not support as yet, and converts it into compatible code that works on all browsers. JavaScript has several types, when any one of these types are included in a .ts file, TypeScript automatically infers as to what type it is. However the real necessity for using TypeScript is that it catches code errors during development, so in order for this to happen the type must be explicitly stated within the code, thereby eliminating code inference and reducing the chances of your JavaScript code breaking in the future.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了