- 1.Introduction to TypeScript
- 2.How to setup a React Typescript application
Static typing means every variable needs to be declared with a specific data type, and cannot store values that do not adhere to that data type. While requiring more upfront effort to define the type of each variable, static typing can increase development speed in the long term by reducing bugs due to ambiguous typing of variables. Popular languages like Java and Go require static typing, and their robustness due to static typing is a large reason for their popularity.
Introduction to TypeScript by Robert Kolsek, Rocket Academy Section Leader
- 1.Understand Static type-checking, which ensures that your code will be able to run, before you try to run and execute your code.
- 3.Use Explicit Types when developing to describe the values that you will invoke functions with.
- 1.Primitives, and Complex data types and how you annotate them within TypeScript.
- 2.Type Aliases and Interfaces allow us to define objects that we want to use within our functions. These features are almost interchangeable, but the key difference is that a tpye cannot be re-opened to add new properties while and interface is always extendable.
- 3.Type Assertions are vital if you are getting information from a DOM element.
When creating React applications you are able to add TypeScript into the project when using the Create-React-App. Use the command below to create a React boilerplate that contains TypeScript.
npx create-react-app name-of-app --template typescript
When working on a React TypeScript project we need to being to apply Typing to many React concepts, like Props as well as States. To understand this and more please have a look at the following sets of documentation.
These are just some set of documentation that you can look through to get started while developing a React TypeScript project. Now try to build up a project using TypeScript!