TypeScript Basic Types Flashcards

1
Q

How many basic types does TypeScript have?

A

As of version 3.3, it has 11 basic types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the basic TypeScript types?

A

Boolean
Number
String
Array
Tuple
Enum
Any
Void
Null and Undefined
Never
Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Tell me about the Boolean type as used in TypeScript…

A

The most basic datatype is the simple true/false value, which JavaScript & TypeScript call a boolean value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Tell me about the Number type as used in TypeScript…

A

As in JavaScript, all numbers in TypeSctipt ate floating point values, These floating point numbers get the type “number”.

In addition to hexadecimal and decimal literals, TypeScript also supports binary and octal literals introduced in ECMAScript 2015.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Tell me about the String type as used in TypeScript…

A

As in other languages, TypeScript uses the type “string” to refer to textual datatypes. Just like JavaScript, TypeScript also uses double quotes or single quotes to surround string data.

Template strings are also usable in TypeScript ie using the backtick/backquote, embedded expressions and multiple lines (as per JavaScript).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Tell me about the Array type as used in TypeScript…

A

Like JavaScript, TypeScript allows you to work with arrays of values.

Array types can be written in two ways:

  1. let list: number[] = [1, 2, 3];

OR

  1. let list: Array<number> = [1, 2, 3];</number>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly