Flashcard Deck · 24 cards · Public

TypeScript Essentials - Types, Interfaces & Generics

Master the fundamentals of TypeScript to build type-safe, scalable applications. Learn primitive types, interface definitions, custom type aliases, and reusable generics with practical code examples.

Cards in this deck

(24 cards)

Preview terms and definitions before starting your study session.

#1
Term
What is TypeScript?
Definition
TypeScript is a strongly typed, open-source programming language developed by Microsoft that builds on JavaScript by adding static type definitions. TypeScript code compiles (transpiled) down to plain JavaScript.
#2
Term
Primitive Types
Definition
TypeScript supports JavaScript's primitive types: number, string, boolean, null, undefined, symbol, and bigint.
typescript3 lines
let count: number = 42;
let name: string = "Alice";
let isActive: boolean = true;
#3
Term
Type Annotation
Definition
An explicit mechanism to specify the intended type of a variable, function parameter, or return value using a colon (:).
typescript3 lines
function add(a: number, b: number): number {
  return a + b;
}
#4
Term
Type Inference
Definition
TypeScript automatically determines and assigns a type to a variable based on its initial value when no explicit type annotation is provided.
typescript1 line
let message = "Hello World"; // Inferred as string
#5
Term
The any Type
Definition
A escape hatch type that disables all static type checking for a variable. Usage of any allows reading/writing arbitrary properties and calling non-existent methods without compile-time errors.
#6
Term
The unknown Type
Definition
A type-safe counterpart to any. Represents any value, but TypeScript prevents performing arbitrary operations on an unknown variable until its type is narrowed via explicit type checks.
#7
Term
The void Return Type
Definition
Indicates that a function does not return a value (or returns undefined).
typescript3 lines
function logMessage(msg: string): void {
  console.log(msg);
}
#8
Term
The never Type
Definition
Represents values that never occur. It is used as the return type for functions that always throw an exception or enter an infinite loop, or for impossible branches in type narrowing.
Showing 8 of 24 cards in this deck.
Study All Now

Related Flashcard Sets

Explore similar study materials created by the community

Browse community decks