Typescript

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

13 Terms

1
New cards

What are generics in TypeScript?

A way to create reusable, type-safe code by passing types as parameters.

2
New cards

Why use generics instead of any

Generics preserve type information and provide compile-time safety.

3
New cards

What does unknown do?

Forces type checking before usage.

4
New cards

Why is unknown safer than any?

You must narrow the type before using it.

5
New cards

When should you use unknown?

External data (API responses, user input).

6
New cards

What is an enum?

A named set of constant values.

7
New cards

What does Partial<T> do?

Makes all properties optional.

8
New cards

What does Pick do?

Creates a type with selected properties.

9
New cards

What does Omit do?

Removes specific properties from a type.

10
New cards

What does Record do?

Creates an object type with keys K and values V.

11
New cards

What does Readonly do?

Makes all properties immutable.

12
New cards

Main difference between type and interface

interface can be extended & merged
type is more flexible (unions, primitives)

13
New cards

Why avoid enums in frontend apps?

→ Bundle size, runtime cost, less flexible than unions.