Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 25, 2022 06:57 am GMT

Typescript with React

What is Typescript?

Typescript is a superset of the JavaScript language. The purpose is to give JavaScript a flavor of strongly typed language so that our code errors are easily detected and we are protected from many unwanted behaviors in the application. Typescript cannot be written in a browser like JavaScript.

Globally typescript installation:
yarn global add typescript
or
npm install typescript -g

Installation typescript in local project:
yarn add typescript
or
npm install typescript

Initialization typescript in project

tsc --init

How to compile a specific file?
tsc app.ts

How to compile a specific file with watch mood?
tsc app.ts -w

Compilation of all files and also with watch mood:
tsc
tsc -w

Basic data types:

  • Any
  • number
  • string
  • boolean
  • object
  • Array
  • Tuple
  • Enum
  • undefined
  • null, void
  • never
  • unknown

Original Link: https://dev.to/programmershahjalal/typescript-with-react-3kbp

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To