TIL. TypeScript_ type

chloe·2021년 4월 11일
0

Typescript

목록 보기
7/8
post-thumbnail

Type?

Easy way to refer to the different properties and functions that a value has.

There's a lot of meaning in the statement right here so let's kind of break it apart piece by piece.

1. what is a value?
value in Javascript and typescript is anything that we can assign to a variable.
We can assign strings, numbers, boolean, null, undefined, objects, functions, classes, arrays and so on..

2. what does mean that an easy way to refer to the different properties and functions?

Let's look at the below.

  • "red" => It is a string / It is a value that has all the properties + methods that we assume that a string has

Every value in typescript has a type!!

There are two different categories of types.

Why do we care about types?

There are two big reasons.
First, Types are used by the Typescript Compiler to analyze our code for errors. Second, Types allow other engineers to understand what value are flowing around our codebase

profile
Front-end Developer 👩🏻‍💻

0개의 댓글