Convert Figma logo to code with AI

total-typescript logobeginners-typescript-tutorial

An interactive TypeScript tutorial for beginners

7,780
1,012
7,780
12

Top Related Projects

100,112

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Collection of TypeScript type challenges with online judge

44,903

Cheatsheets for experienced React developers getting started with TypeScript

:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹

A collection of awesome TypeScript resources for client-side and server-side development. Write your awesome JavaScript in TypeScript

Quick Overview

The "beginners-typescript-tutorial" repository is an interactive TypeScript tutorial designed for beginners. It provides a series of exercises to help users learn TypeScript fundamentals through hands-on practice, covering topics from basic types to advanced concepts like generics and utility types.

Pros

  • Interactive learning approach with practical exercises
  • Comprehensive coverage of TypeScript concepts
  • Well-structured content with clear progression
  • Suitable for beginners and those transitioning from JavaScript

Cons

  • May not cover very advanced TypeScript topics
  • Requires some basic JavaScript knowledge
  • Limited explanation of theoretical concepts
  • Might be too basic for experienced TypeScript developers

Code Examples

Here are a few examples of the types of exercises included in the tutorial:

  1. Basic Types:
const firstName: string = "John";
const age: number = 30;
const isStudent: boolean = false;
  1. Function Types:
function greet(name: string): string {
  return `Hello, ${name}!`;
}
  1. Generics:
function identity<T>(arg: T): T {
  return arg;
}

const result = identity<number>(42);

Getting Started

To get started with this tutorial:

  1. Clone the repository:

    git clone https://github.com/total-typescript/beginners-typescript-tutorial.git
    
  2. Install dependencies:

    cd beginners-typescript-tutorial
    npm install
    
  3. Start the exercise runner:

    npm run exercise 01
    
  4. Follow the instructions in the console and edit the corresponding TypeScript files to complete each exercise.

Competitor Comparisons

100,112

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Pros of TypeScript

  • Official repository with comprehensive documentation and resources
  • Larger community and more frequent updates
  • Extensive API and advanced features for complex projects

Cons of TypeScript

  • Steeper learning curve for beginners
  • Less focused on practical, hands-on tutorials
  • More complex setup and configuration required

Code Comparison

TypeScript (advanced type manipulation):

type Flatten<T> = T extends Array<infer U> ? U : T;

type Flattened = Flatten<number[]>; // number

beginners-typescript-tutorial (basic type usage):

type User = {
  name: string;
  age: number;
};

const user: User = { name: "John", age: 30 };

Summary

TypeScript is the official repository for the TypeScript language, offering comprehensive documentation and advanced features. It's ideal for experienced developers working on complex projects. beginners-typescript-tutorial, on the other hand, is designed for newcomers to TypeScript, providing practical, hands-on exercises to learn the basics. While TypeScript offers more depth and breadth, beginners-typescript-tutorial focuses on accessibility and ease of learning for those new to the language.

Collection of TypeScript type challenges with online judge

Pros of type-challenges

  • Offers a wider range of challenges, from easy to extreme difficulty
  • Focuses on advanced TypeScript concepts and edge cases
  • Community-driven with contributions from many developers

Cons of type-challenges

  • May be overwhelming for beginners due to its complexity
  • Lacks structured learning path or curriculum
  • Minimal explanations for solutions, requiring more independent research

Code Comparison

beginners-typescript-tutorial:

// Example: Basic function type annotation
function greet(name: string): string {
  return `Hello, ${name}!`;
}

type-challenges:

// Example: Complex type manipulation
type DeepReadonly<T> = {
  readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
};

The beginners-typescript-tutorial repository provides a more structured approach to learning TypeScript basics, making it ideal for newcomers. It offers step-by-step tutorials and explanations, focusing on fundamental concepts.

On the other hand, type-challenges is better suited for intermediate to advanced TypeScript users looking to deepen their understanding of the type system. It presents a collection of challenging type puzzles that push the boundaries of TypeScript's capabilities.

While beginners-typescript-tutorial helps build a solid foundation, type-challenges excels in honing advanced skills and exploring complex type manipulations. The choice between the two depends on the learner's experience level and learning goals.

44,903

Cheatsheets for experienced React developers getting started with TypeScript

Pros of react

  • More comprehensive coverage of React-specific TypeScript patterns and best practices
  • Regularly updated with contributions from a large community
  • Includes advanced topics like performance optimization and testing

Cons of react

  • May be overwhelming for absolute beginners due to its extensive content
  • Less structured learning path compared to a step-by-step tutorial format
  • Focuses primarily on React, limiting its applicability to general TypeScript usage

Code Comparison

beginners-typescript-tutorial example:

type User = {
  id: number;
  name: string;
};

function greetUser(user: User) {
  console.log(`Hello, ${user.name}!`);
}

react example:

interface Props {
  user: {
    id: number;
    name: string;
  };
}

const GreetingComponent: React.FC<Props> = ({ user }) => {
  return <h1>Hello, {user.name}!</h1>;
};

The react example demonstrates TypeScript usage within a React component context, while beginners-typescript-tutorial focuses on basic TypeScript concepts without React-specific implementation.

:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹

Pros of typescript-book

  • Comprehensive coverage of TypeScript concepts, suitable for beginners to advanced users
  • Regularly updated with new TypeScript features and best practices
  • Available as a free online resource with a well-organized structure

Cons of typescript-book

  • Less interactive compared to hands-on tutorials
  • May be overwhelming for absolute beginners due to its extensive content
  • Lacks guided exercises or projects for practical application

Code Comparison

typescript-book:

interface Point {
  x: number;
  y: number;
}

function printPoint(p: Point) {
  console.log(`${p.x}, ${p.y}`);
}

beginners-typescript-tutorial:

type Point = {
  x: number;
  y: number;
};

const printPoint = (p: Point): void => {
  console.log(`${p.x}, ${p.y}`);
};

Both repositories provide valuable resources for learning TypeScript. typescript-book offers a more comprehensive and in-depth approach, suitable for a wide range of skill levels. beginners-typescript-tutorial focuses on hands-on learning with interactive exercises, making it more engaging for beginners. The code comparison shows slight differences in syntax and style, with typescript-book using interfaces and function declarations, while beginners-typescript-tutorial uses type aliases and arrow functions.

A collection of awesome TypeScript resources for client-side and server-side development. Write your awesome JavaScript in TypeScript

Pros of awesome-typescript

  • Comprehensive collection of TypeScript resources, including tutorials, articles, and tools
  • Regularly updated with new content and community contributions
  • Covers a wide range of TypeScript topics, from beginner to advanced levels

Cons of awesome-typescript

  • Less structured learning path compared to beginners-typescript-tutorial
  • May be overwhelming for absolute beginners due to the sheer amount of information
  • Lacks hands-on exercises and interactive learning components

Code comparison

While awesome-typescript doesn't provide direct code examples, beginners-typescript-tutorial offers practical exercises. Here's a sample from beginners-typescript-tutorial:

// Exercise: Type the `addTwoNumbers` function
export const addTwoNumbers = (a, b) => {
  return a + b;
};

awesome-typescript focuses on curating resources rather than providing code examples directly.

Summary

beginners-typescript-tutorial is more suitable for newcomers seeking a structured, hands-on approach to learning TypeScript. awesome-typescript serves as an extensive resource hub for TypeScript developers at various skill levels, offering a wealth of information but requiring more self-directed learning.

Both repositories have their merits, and developers may find value in using them complementarily: starting with beginners-typescript-tutorial for foundational knowledge, then exploring awesome-typescript for deeper insights and additional resources.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

beginner typescript tutorial

Quickstart

Take the course on Total TypeScript. There, you'll find:

  • Video explanations for each problem and solution
  • Transcripts
  • Text explanations
  • A built-in Stackblitz editor
# Installs all dependencies
npm install

# Asks you which exercise you'd like to run, and runs it
npm run exercise

How to take the course

You'll notice that the course is split into exercises. Each exercise is split into a *.problem and a *.solution.

To take an exercise:

  1. Run npm run exercise
  2. Choose which exercise you'd like to run.

This course encourages active, exploratory learning. In the video, I'll explain a problem, and you'll be asked to try to find a solution. To attempt a solution, you'll need to:

  1. Check out TypeScript's docs.
  2. Try to find something that looks relevant.
  3. Give it a go to see if it solves the problem.

You'll know if you've succeeded because the tests will pass.

If you succeed, or if you get stuck, unpause the video and check out the *.solution. You can see if your solution is better or worse than mine!

Acknowledgements

Say thanks to Matt on Twitter or by joining his Discord. Consider signing up to his Total TypeScript course.

Reference

npm run exercise

Alias: npm run e

Open a prompt for choosing which exercise you'd like to run.