Menu
CoddyTech
Course

TypeScript for C# Developers

Learn JavaScript runtime semantics and TypeScript structural contracts from C#. Practice flow, functions, collections and class modules, then build a validated order-processing tool.

C# and TypeScript side by side

The same program in C# and in TypeScript, from the lessons of this course.

  1. Run TypeScript

    C# normally runs a Main method or top-level statements on .NET. TypeScript compiles to JavaScript and this course executes it on Node. The checker erases annotations before execution. No JavaScript prerequisite is assumed; the locked main reads JSON while you…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8string name = "Ada";9Console.WriteLine($"Hello, {name}!");10}11}
    TypeScript
    1const name: string = "Ada";2console.log(`Hello, ${name}!`);
  2. Numbers and Conversion

    C# int.Parse throws for malformed text, while TryParse reports success separately. JavaScript Number returns NaN for invalid text and zero for blank strings. Check blankness and finiteness before adding; + can concatenate when a string operand remains.…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8Console.WriteLine(int.Parse("12", CultureInfo.InvariantCulture) + 3);9}10}
    TypeScript
    1const value: number = Number("12");2console.log(value + 3);
  3. Arrays and Slice

    C# arrays have fixed length and out-of-range access throws. JavaScript arrays resize and missing indexed reads yield undefined. Slice copies a range with exclusive end and negative-offset support, whereas splice modifies the original. LINQ Skip/Take is a…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8int[] values = {1, 2, 3, 4};9Console.WriteLine("[" + string.Join(", ", values.Skip(1).Take(values.Length - 2)) + "]");10}11}
    TypeScript
    1const values: number[] = [1, 2, 3, 4];2console.log(JSON.stringify(values.slice(1, -1)));
  4. For-of and Array Values

    C# foreach becomes TypeScript for-of. For-in is key enumeration, not the equivalent collection-value loop. Braces and block scope are familiar; declare the accumulator with let and each loop binding with const when it is not reassigned. JavaScript uses braces…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8int total = 0;9foreach (int value in new[]{3, -1, 2}) { if (value > 0) total += value; }10Console.WriteLine(total);11}12}
    TypeScript
    1let total: number = 0;2for (const value of [3, -1, 2]) { if (value > 0) total += value; }3console.log(total);
  5. Truthiness Is Not Emptiness

    C# collections cannot be used directly as boolean conditions. JavaScript permits arrays in conditions and even empty arrays are truthy. This source explicitly tests non-emptiness and prints false; the TypeScript Boolean([]) example prints true. JavaScript…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8var values = new List<int>();9Console.WriteLine((values.Count > 0).ToString().ToLowerInvariant());10}11}
    TypeScript
    1const value: unknown = [];2console.log(Boolean(value));
  6. Annotations and Inference

    C# distinguishes int, double and decimal. TypeScript number uses JavaScript binary floating-point arithmetic and does not provide C# decimal semantics. For the later order project, integer cents avoid accidental assumptions about decimal money calculations.…

    C#
    1using System;2using System.Linq;3using System.Collections.Generic;4using System.Globalization;5public class Program {6
    7public static void Main() {8decimal price = 2.5m;9int count = 4;10Console.WriteLine((price * count).ToString("0.##", CultureInfo.InvariantCulture));11}12}
    TypeScript
    1const price: number = 2.5;2const count = 4;3console.log(price * count);

Syllabus

12 chapters48 lessons1 project48 challenges96 quiz questions

Start Here

1 lesson

Final Challenges

2 lessons

More courses for C# developers

Learn TypeScript from another language

Frequently asked questions

Who is TypeScript for C# Developers for?

For people who already write C# and want to learn TypeScript. Each lesson starts from C# you know and shows how TypeScript does the same thing, so you skip the beginner basics.

Do I need to know TypeScript already?

No. The course starts with your first TypeScript program. You need C# basics: variables, conditions, loops, functions and collections.

How many lessons does TypeScript for C# Developers have?

TypeScript for C# Developers contains 48 interactive lessons you can complete at your own pace.

What does TypeScript for C# Developers cover?

The course is organized into chapters covering: Start Here, Runtime Values, Runtime Collections, Runtime Control Flow, and more.

Is TypeScript for C# Developers free?

Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.

Coddy programming languages illustration

Start TypeScript for C# Developers for free

Get started