TypeScript Crash Course for Beginners
A chapter-by-chapter readback of the free course by GlitchyDevs on freeCodeCamp.org.
- Foundations and the compiler workflow
- Annotations and typed functions
- Compose types and model collections
- Interfaces and object contracts
- Classes, encapsulation, and inheritance
- Generics, assertions, and debugging
The course connects language basics with the practical compile-and-debug workflow: create a TypeScript file, configure JavaScript output, then use source maps and breakpoints. Its later examples connect interfaces, product classes, inheritance, and generic collections rather than stopping at variable annotations.
- You know basic JavaScript and want a first walkthrough of TypeScript.
- You want short examples of typed functions, object structures, interfaces, classes, and generics.
- You want to compile TypeScript with tsc, run the JavaScript with Node.js, and debug in VS Code.
- You still need an introduction to basic JavaScript.
- You want a course centered on building a complete application rather than demonstrating individual features.
- You want a dedicated React or Next.js implementation tutorial; those frameworks appear as suggested next steps.
- Runtime: 60 minutes, 34 seconds.
- Study-guide structure: 20 chapters grouped into 6 thematic modules.
- Level: TypeScript beginner, with basic JavaScript knowledge expected.
- Tools: Git, VS Code, Node.js LTS, npm, and the TypeScript compiler.
- Coverage: annotations, functions, unions, interfaces, classes, generics, and source-map debugging.
The walkthrough
Each chapter below is our original written explanation of what happens at that moment in the video — a paraphrase, not a transcript. Click any timestamp to jump the player.
Foundations and the compiler workflow
Introduction
Learn how TypeScript adds static type checking to JavaScript and how that differs from allowing variable types to change during execution. The opening also explains transpilation, early error feedback, and the prerequisite of basic JavaScript knowledge.
Install tools and compile your first file
Set up Git, VS Code, Node.js LTS, and the TypeScript compiler, then create index.ts. A missing Math.floor argument demonstrates editor feedback before the file is compiled to JavaScript and run with Node.js.
Configure source and output directories
Move the TypeScript file into a source directory and generate a compiler configuration. Configure the source and output locations, compile the project, and run the generated JavaScript from its output directory.
Annotations and typed functions
Type annotations, inference, and any
Explore explicit annotations, delayed assignment, and the compiler's ability to infer types from initial values. The presenter favors explicit annotations and cautions that any gives up type checking for the affected value.
Describe object shapes
Annotate an object with required name and age fields, an optional job title, and a nested address. The example shows how property-level types describe the structure an object must satisfy.
Type functions and flexible parameter lists
Specify parameter and return types using an area calculation, then explore optional, default, and rest parameters. Numeric summation, arrow functions, and anonymous functions demonstrate several ways to write typed operations.
Distinguish void from never
Separate functions that produce no meaningful return value from functions that never return normally. The examples associate never with thrown exceptions, infinite loops, and unreachable code.
Compose types and model collections
Unions, literals, and nullable values
Allow a value to belong to several specified types, or restrict it to exact options such as directions and colors. Nullable examples represent absent usernames and ages explicitly, including a greeting that handles a null username.
Type aliases and intersections
Give reusable names to primitive, union, and object types, including an Employee structure with optional email. Then combine existing types with an intersection so the resulting type includes their members.
Arrays, tuples, and enums
Constrain array elements to a single type or a union, and use a tuple to describe differently typed positions. A days-of-the-week enum introduces named numeric options and looking up a name from its numeric value.
Interfaces and object contracts
Interface properties and method signatures
Define the properties an object must provide, then add a greeting method with a typed parameter and void return. The Person examples show how an interface describes both data and callable behavior.
Reopen interfaces and explore DOM types
Combine repeated interface declarations into a settings structure that includes a readonly property and additional fields. The lesson then introduces built-in DOM interfaces through image-element properties and behavior.
Compare interfaces and type aliases
Compare the two ways of naming custom types, with particular attention to interface declaration merging. The presenter discusses choosing interfaces for object contracts and aliases for unions, intersections, and other type combinations.
Classes, encapsulation, and inheritance
Typed classes and access modifiers
Build a product class with typed properties, constructor parameters, and a method returning product information. Compare public, private, and protected members to control where class details can be accessed.
Accessors, static members, and interface implementation
Use a getter and setter to manage a price while rejecting negative values, then generate product IDs through class-level static members. A class implementation example supplies the fields and methods required by an interface.
Abstract classes and polymorphism
Define an abstract base class with a method that subclasses must implement. Derived objects then provide different information methods while being referenced through a common base-class type.
Generics, assertions, and debugging
Generic functions and reusable collections
Use type parameters to preserve relationships between function inputs and outputs, including examples with two different types. Generic class examples introduce a default type and collections that accept only objects matching their chosen item type.
Type assertions
See an assertion tell the compiler to treat an any-typed value as a string before calling a string method. The segment presents assertions as a way to supply type information the compiler has not determined.
Debug TypeScript in VS Code
Enable source maps, recompile, and configure a Node.js launch with a TypeScript build task. Use breakpoints, stepping controls, the Variables panel, and Watch expressions to inspect execution.
Continue practicing and exploring configuration
The closing advice emphasizes writing code and trying TypeScript in new React or Next.js projects. It also points to open-source code, official documentation, and experiments with compiler configuration as ways to continue learning.
Moment by moment
| Time | Why it matters |
|---|---|
| 5:55 | A missing Math.floor argument shows how the editor catches a problem before execution. |
| 20:53 | Union types introduce controlled alternatives without allowing every possible value. |
| 32:54 | Repeated interface declarations expand one shared object contract. |
| 50:01 | Generics shift the examples toward reusable code with type relationships preserved. |
| 56:20 | Source maps connect compiled JavaScript execution to TypeScript debugging. |
Do this next
- Recreate the index.ts setup, configure separate source and output directories, compile with tsc, and run the generated JavaScript with Node.js.
- Write an Employee type with an optional email and a greeting function that accepts string or null; try valid and invalid inputs to observe compiler feedback.
- Rebuild the generic collection example for books, then enable source maps and step through its add method while watching the collection's data array.
Common questions
Do I need JavaScript knowledge before taking this course?
Yes. The presenter explicitly names basic JavaScript knowledge as the prerequisite; the lessons focus on adding types and using the TypeScript workflow.
What do I need installed to follow along?
The setup uses Git, Visual Studio Code, Node.js LTS, and a globally installed TypeScript compiler through npm. The walkthrough compiles TypeScript with tsc and executes the generated JavaScript with Node.js.
Does the course cover more than basic type annotations?
Yes. It continues into interfaces and declaration merging, classes and access modifiers, abstract classes and polymorphism, generic functions and collections, type assertions, and VS Code debugging.
Does the tutorial build a React or Next.js application?
The supplied lessons demonstrate individual language features with examples such as products, greetings, and collections. React and Next.js appear in the closing suggestions for further practice, rather than as a framework application walkthrough.
Spot a mistake?
Every summary is hand-checked against the video. If you notice an error in a timestamp, explanation, or attribution, email us with the relevant detail so we can review it.
More course guides
- SQL Tutorial – Full Database Course for BeginnersfreeCodeCamp.org · 4:20:36
- Learn Python – Full Course for BeginnersfreeCodeCamp.org · 4:27:21
- Agentic AI – Complete Course for BeginnersfreeCodeCamp.org · 24:15:52