Menu
CoddyTech
Course

GDScript for TypeScript Developers

Move from TypeScript to Godot 4 GDScript through 48 multi-file tasks: typing, collections, script classes, callables, signals and failure contracts. Build a connected stock depot and port two TypeScript programs.

TypeScript and GDScript side by side

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

  1. Text and Comments

    TypeScript runs as JavaScript after its types are removed; Node can execute top-level statements. GDScript executable statements belong inside functions, and the runner invokes the Node entry point. Node console.log inserts spaces between these arguments…

    TypeScript
    1console.log("tag", 7);2console.log("# data");3export {};
    GDScript
    1extends Node2
    3func _ready() -> void:4	print("tag", 7)5	print("# data")
  2. Branches and Values

    TypeScript uses braces and a condition-first ternary expression. GDScript uses indentation, colons and elif; its conditional expression places the true value before the condition. Both execute only the selected branch. Narrowing in TypeScript can refine a…

    TypeScript
    1const n: number = -2;2console.log(n < 0 ? "west" : "east");3export {};
    GDScript
    1extends Node2
    3func _ready() -> void:4	var n: int = -25	print("west" if n < 0 else "east")
  3. Array Operations

    TypeScript arrays are JavaScript objects with a statically described element type. GDScript Arrays are growable containers with their own checked indexing behavior. JavaScript negative bracket indices are properties rather than positions from the end…

    TypeScript
    1const items: number[] = [3];2items.push(8);3console.log(`${items.pop()} ${items.length}`);4export {};
    GDScript
    1extends Node2
    3func _ready() -> void:4	var items: Array = [3]5	items.append(8)6	var removed = items.pop_back()7	print("%d %d" % [removed,items.size()])
  4. String Operations

    TypeScript uses immutable JavaScript strings. GDScript String operations such as replace also return a result rather than rewriting the original variable. JavaScript replace with a string pattern replaces only the first occurrence; replaceAll explicitly…

    TypeScript
    1const s: string = "a-b-a";2const t = s.replaceAll("-", "/");3console.log(s, t);4export {};
    GDScript
    1extends Node2
    3func _ready() -> void:4	var s: String = "a-b-a"5	var t: String = s.replace("-","/")6	print(s," ",t)
  5. Scripts as Classes

    TypeScript modules can export several types, and class declarations execute as JavaScript classes. A GDScript file is itself a script class; class_name registers a global name and extends selects its base. Keep each data class in its own file. RefCounted is…

    TypeScript
    1export class Token { text: string = "blue"; }
    GDScript
    1class_name DemoToken2extends RefCounted3var text: String = "blue"
  6. Inheritance and Super

    TypeScript classes extend one JavaScript superclass and can implement multiple erased interfaces. GDScript also extends one base class but does not turn TypeScript interfaces into runtime engine objects. A subclass can extend parent behavior with super.…

    TypeScript
    1export class Base { label(): string { return "base"; } }
    GDScript
    1class_name DemoBase2extends RefCounted3func label() -> String:4	return "base"

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

More courses for TypeScript developers

Learn GDScript from another language

Frequently asked questions

Who is GDScript for TypeScript Developers for?

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

Do I need to know GDScript already?

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

How many lessons does GDScript for TypeScript Developers have?

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

What does GDScript for TypeScript Developers cover?

The course is organized into chapters covering: Scripts and Scalar Values, Flow and Functions, Collection Ownership, Text and Callable Values, and more.

Is GDScript for TypeScript 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 GDScript for TypeScript Developers for free

Get started