Teyro
CoursesFor creatorsBlog
Log inGet started
Tey Mascot
LOADING.

Every expert you admire was once a beginner who refused to quit.

Teyro

The fun way to finish learning coding and AI: short daily lessons with streaks, leagues and friends.

Get the app

Learn

  • All courses
  • Learn coding
  • Learn AI
  • Learn online
  • How it works
  • Leagues
  • Get the app

Creators

  • Teach on Teyro
  • How teaching works
  • Teach coding online
  • Teach AI online
  • Join as a Founding Creator
  • Creator log in

Resources

  • Blog
  • Features
  • Use cases
  • Compare
  • FAQ

Legal

  • Terms of Use
  • Privacy Policy

© 2026 Teyro · support@teyro.app

HomeBlogSkill Building & Careers
Skill Building & Careers

TypeScript Tutorial for Beginners: Types, Examples and Next Steps

A beginner TypeScript tutorial: basic types, functions, interfaces, unions, how to compile and run it, how long it takes to learn and what to build.

The Teyro TeamOct 25, 20262 min read
On this page12 sections
  1. Direct answer
  2. Basic types
  3. Functions
  4. Interfaces
  5. Union types
  6. Running TypeScript
  7. Topics to learn
  8. How long?
  9. Related
  10. Where Teyro fits
  11. The bottom line
  12. More coding guides

TypeScript adds types to JavaScript so many mistakes are caught before your code runs. The basics are quick to learn if you know JavaScript.

Direct answer

To learn TypeScript: learn JavaScript first, add type annotations to variables and functions, learn interfaces and union types, then generics and how it works with your tools. Practise in an online playground or compile files with the TypeScript compiler. The basics take days to a couple of weeks if you know JavaScript.

Basic types

let name: string = "Sam";
let age: number = 30;
let isMember: boolean = true;
let scores: number[] = [10, 20, 30];

TypeScript will warn you if you try age = "thirty".

Functions

function greet(name: string, times: number = 1): string {
  return `Hello, ${name}! `.repeat(times);
}

Interfaces

interface User {
  id: number;
  name: string;
  email?: string; // optional
}

const user: User = { id: 1, name: "Sam" };

Union types

function printId(id: number | string) {
  console.log(id);
}

Running TypeScript

Browsers can't run TypeScript directly. It's compiled to JavaScript:

  1. Install Node.js.
  2. Install TypeScript using the official instructions.
  3. Write app.ts.
  4. Compile with tsc.
  5. Run the output.

Or use an online playground to start.

Topics to learn

  1. Basic types
  2. Functions
  3. Objects and interfaces
  4. Unions and literal types
  5. Generics
  6. Working with libraries and frameworks

How long?

If you already know JavaScript, a couple of weeks of regular practice covers the basics.

Related

TypeScript vs JavaScript and JavaScript for beginners.

Where Teyro fits

Teyro's TypeScript for Beginners course teaches types step by step in 20 short lessons. It is free to start.

The bottom line

Know JavaScript, add types gradually.

More coding guides

  • TypeScript vs JavaScript
  • JavaScript for beginners
  • JavaScript DOM tutorial
  • TypeScript course

Frequently asked questions

How do I start learning TypeScript?

Learn JavaScript basics first, then add type annotations to variables and functions, learn interfaces and unions, and set up the compiler or use an online playground.

How long does it take to learn TypeScript?

If you know JavaScript, the basics take days to a couple of weeks. Advanced types take longer.

Do I need to install anything?

You can practise in an online playground, or install Node.js and TypeScript to compile files yourself.

What topics should I learn?

Basic types, functions, objects and interfaces, unions, generics and how TypeScript works with your framework.

Learn TypeScript in short lessons

TypeScript for Beginners: 20 short lessons, free to start.

See the TypeScript course

Free to start · No credit card needed

Share

Written by

The Teyro Team

Learning Team at Teyro

We build Teyro — an AI-powered learning platform that turns skill-building into a daily habit through bite-sized, gamified lessons. We write about the learning science and study strategies that shape our product.

More from The Teyro Team

On this page

  • Direct answer
  • Basic types
  • Functions
  • Interfaces
  • Union types
  • Running TypeScript
  • Topics to learn
  • How long?
  • Related
  • Where Teyro fits
  • The bottom line
  • More coding guides

Keep reading

Skill Building & Careers

Best Careers for 2027: High-Demand Jobs and the Skills to Get Them

The best careers for 2027 and the jobs most in demand, based on BLS and World Economic Forum data, plus the skills each path needs.

Oct 30, 20263 min read
Skill Building & Careers

Best Certifications for 2027: Tech, Data, Cloud and Business

The best certifications for 2027 in cloud, security, data, project management and AI, who each one suits, and when a portfolio matters more.

Oct 30, 20263 min read
Skill Building & Careers

Best Programming Language to Learn in 2027 (for Your Goal)

The best programming language to learn in 2027 depends on what you want to build. Compare Python, JavaScript, TypeScript, SQL and C.

Oct 30, 20263 min read