Skip to content

Typescript Essentials

Master Typescript Essentials with 51 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 51 cards ⏱️ ~26 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

What is TypeScript?

Show ▼

TypeScript is a statically typed superset of JavaScript developed by Microsoft that compiles to plain JavaScript code. It adds optional static typing, interfaces, classes, and modules to enhance code scalability, maintainability, and developer productivity.

How does TypeScript relate to JavaScript?

Show ▼

TypeScript is a superset of JavaScript, meaning all valid JavaScript code is also valid TypeScript. TypeScript code is transpiled to JavaScript, allowing it to run in any JavaScript environment.

How do you install TypeScript?

Show ▼

Install TypeScript globally using npm install -g typescript or locally as a dev dependency with npm install typescript --save-dev. Verify installation with tsc --version.

What is the TypeScript compiler command?

Show ▼

The TypeScript compiler is invoked with tsc. Use tsc file.ts to compile a single file or tsc to compile based on tsconfig.json.

What is tsconfig.json?

Show ▼

tsconfig.json is the TypeScript configuration file that specifies compiler options like target JavaScript version, module system, and strictness mode. It controls how TypeScript projects are compiled.

What are primitive types in TypeScript?

Show ▼

Primitive types include number, string, boolean, null, undefined, symbol, and bigint. They are the basic building blocks for typing variables.

How do you declare a typed variable?

Show ▼

Use a type annotation after the variable name with a colon: let name: string = "Alice";. TypeScript infers types when possible but explicit annotations improve clarity.

What is type inference in TypeScript?

Show ▼

TypeScript automatically infers the type of a variable from its initializer. For example, let count = 5; infers number, reducing boilerplate while maintaining type safety.

What is the 'any' type?

Show ▼

The any type disables type checking, allowing a value to be treated as any type. It should be used sparingly as it bypasses TypeScript's benefits; prefer unknown for safer alternatives.

What is the 'unknown' type?

Show ▼

unknown is a top type like any but safer, requiring type checks or narrowing before use. It ensures type safety by preventing direct operations on unknown values.

What is the 'never' type?

Show ▼

The never type represents values that never occur, such as exhaustive switch statements or impossible code paths. It is useful for function return types that always throw errors.

How do you type an array?

Show ▼

Use array syntax like let numbers: number[] = [1, 2, 3]; or generic Array<number>. Arrays can hold homogeneous or heterogeneous types with tuples.

🎓 Start studying Typescript Essentials

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources