- Hybrid Mobile Development with Ionic
- Gaurav Saini
- 331字
- 2021-07-02 23:53:50
TypeScript comes to the rescue
TypeScript is basically a superset of Javascript, which is a statically typed language. TypeScript does similar to what LESS or SASS does to CSS. TypeScript compiles to Javascript and has almost the same syntax. Anyone from an object-oriented world will find it really, familiar with concepts such as classes, constructors, inheritance, and interfaces.
Many developers will be confused with all these keywords such as ES5, ES6, TypeScript, AtScript, and many others. JavaScript is a community-driven language, and accordingly, browser manufacturers implement those features that are mostly used. Currently, ES5, that is ECMAScript 5, is a standardization by ECMA international. ES6 and ES7 are future standards of JavaScript with tons of new features. We can develop applications in ES6 and ES7 directly with the use of Babel, which is a transpiler. Transpilers are source-to-source compilers that take input in one programming language and output the equivalent code in another language. Although it is recommended to use TypeScript as the majority of work going on in the Ionic community is on TypeScript. Also, you will easily get resources and community help.
When we start a new Ionic 3 project it create the project with TypeScript, although in Ionic 2 and CLI v2 we had option for creating project with TypeScript. As mentioned, we should use TypeScript because, as the project will become a large scale project, things will be easier to maintain and understand. I want to clear up one important point here about Angular 4: whether it's TypeScript or ES 6 whenever you run the Ionic server, our app folder is transpiled into ES5, as that is what currently all major browsers support. There are many new features available in TypeScript that we will be mainly using in our Ionic or Angular applications. Some of them are listed here:
- Class and module support
- Static type-checking
- Similar syntax to other object-oriented languages
- ES6 features such as template string support
- Decorator, annotation support, and dependency injection
- Arrow functions
- 零起步玩轉(zhuǎn)掌控板與Mind+
- Interactive Data Visualization with Python
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)(微課版)
- Unity Virtual Reality Projects
- Python 3網(wǎng)絡(luò)爬蟲實(shí)戰(zhàn)
- Python Network Programming Cookbook(Second Edition)
- Julia Cookbook
- HTML5入門經(jīng)典
- Learn React with TypeScript 3
- 現(xiàn)代C++編程實(shí)戰(zhàn):132個(gè)核心技巧示例(原書第2版)
- 汽車人機(jī)交互界面整合設(shè)計(jì)
- Applied Deep Learning with Python
- 少兒編程輕松學(xué)(全2冊(cè))
- 你必須知道的.NET(第2版)
- Enterprise Application Architecture with .NET Core