Using TypeScript
TypeScript is a full programming language that was designed as a superset of JavaScript. The basic idea was to start with JavaScript, enhance it with missing parts such as types, classes, or enums, and choose JavaScript as a transpilation target for the language. Over the years, many of the features that were first introduced in the TypeScript language also made it to the JavaScript language.
Today, TypeScript is the most popular way to write large-scale JavaScript projects. Nearly every package on the official npm
registry comes with TypeScript-compatible type annotations – either within the package or in a dedicated package. As an example, the type annotations for the react
package can be found in the @
types/react
package.
To use TypeScript, we need to install the typescript
package. This contains the tsc
script, which gives us the ability to check types and transpile TypeScript files written using the .ts
or .
tsx
extension.
Let’s go ahead...