Modern JavaScript Tools & Skills by James Kolce & Mark Brown & Craig Buckler & Michael Wanyoike & Nilson Jacques

Modern JavaScript Tools & Skills by James Kolce & Mark Brown & Craig Buckler & Michael Wanyoike & Nilson Jacques

Author:James Kolce & Mark Brown & Craig Buckler & Michael Wanyoike & Nilson Jacques [Kolce, James]
Language: eng
Format: epub
Publisher: SitePoint
Published: 2018-05-30T23:00:00+00:00


TypeScript

TypeScript is a superset of JavaScript. A valid JavaScript program is also valid TypeScript, but with static typing added. The compiler can also work as a transpiler from ES2015+ to current implementations, so you always get the latest features.

Unlike many other languages, TypeScript keeps the spirit of JavaScript intact, only adding features to improve the soundness of the code. These are type annotations and other type-related functionality that makes writing JavaScript more pleasant, thanks to the enabling of specialized tools like static analyzers and other tools to aid in the refactoring process. Also, the addition of types improve the interfaces between the different components of your applications.

Type inference is supported, so you don’t have to write all the types from the beginning. You can write quick solutions, and then add all the types to get confident about your code.

TypeScript also has support for advanced types, like intersection types, union types, type aliases, discriminated unions and type guards. You can check out all these in the Advanced Types page in the TypeScript Documentation site.

JSX is also supported by adding the React typings if you use React:

class Person { private name: string; private age: number; private salary: number; constructor(name: string, age: number, salary: number) { this.name = name; this.age = age; this.salary = salary; } toString(): string { return `${this.name} (${this.age}) (${this.salary})`; } }

For more on typeScript, check out SitePoint’s getting started with TypeScript article.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.