Typescript Flashcards

1
Q

What is TypeScript?

A

TypeScript is a superset of JavaScript that adds static typing and other features.

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

True or False: TypeScript helps catch errors at compile time.

A

True

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

What is one major benefit of using TypeScript in large-scale applications?

A

Improved maintainability and scalability of the codebase.

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

Fill in the blank: TypeScript provides _____ typing, which helps in identifying type-related errors early.

A

static

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

What feature of TypeScript allows for better documentation and understanding of code?

A

Type annotations

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

Multiple Choice: Which of the following is a benefit of TypeScript?
A) Dynamic typing

B) Improved IDE support

C) Slower performance

A

B) Improved IDE support

An integrated development environment (IDE) is a software application that helps programmers write, test, and build software.
IDEs can help programmers be more efficient and productive by combining tools into a single application.

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

How does TypeScript enhance team collaboration in large projects?

A

By providing clear contracts through interfaces and types.

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

True or False: TypeScript can be gradually adopted in existing JavaScript projects.

A

True

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

What is the role of interfaces in TypeScript?

A

Interfaces define the shape of objects and enforce type checking.

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

Fill in the blank: TypeScript’s _____ feature allows developers to define custom types.

A

union

For context, unions look something like this: function printId(id: number | string) {}

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

What advantage does TypeScript provide for refactoring code?

A

Type checking helps ensure that changes do not introduce new errors.

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

Multiple Choice: Which feature helps TypeScript provide better autocompletion in IDEs? A) Type inference B) Dynamic types C) Loose typing

A

A) Type inference

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

True or False: TypeScript can only be used with React applications.

A

False

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

What is ‘type inference’ in TypeScript?

A

Type inference is the ability of TypeScript to automatically deduce types based on the assigned values.

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

What benefit does TypeScript offer regarding third-party libraries?

A

TypeScript provides type definitions for many popular libraries, improving integration and type safety.

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