TypeScript for GDScript Developers
Learn the JavaScript runtime and TypeScript contracts from GDScript. Compare Variant values, shared containers, Callables and class scripts, then build typed modules and a validated order-processing tool.
GDScript and TypeScript side by side
The same program in GDScript and in TypeScript, from the lessons of this course.
Run TypeScript
GDScript executes inside Godot; this complete Node example runs in _ready and then exits the scene tree. TypeScript also erases types, but this course runner checks and compiles TypeScript before Node executes it. Braces and semicolons replace…
GDScript1extends Node2 3func _ready():4 var name: String = "Ada"5 print("Hello, %s!" % name)6 get_tree().quit()TypeScript1const name: string = "Ada";2console.log(`Hello, ${name}!`);Numbers and Conversion
GDScript String.to_int is a conversion helper rather than a general validation contract; is_valid_int checks integer text before conversion here. JavaScript Number returns NaN instead, and unexpectedly converts blank text to zero. Validate blankness and…
GDScript1extends Node2 3func _ready():4 var text = "12"5 if text.is_valid_int():6 print(text.to_int() + 3)7 get_tree().quit()TypeScript1const value: number = Number("12");2console.log(value + 3);Arrays and Slice
GDScript Array.slice copies an exclusive-end range and accepts negative offsets. A negative GDScript array index can address the end; a negative JavaScript bracket property does not do that. Use at(-1) or an explicit length-based index. An out-of-range…
GDScript1extends Node2 3func _ready():4 var values = [1, 2, 3, 4]5 print(JSON.stringify(values.slice(1, -1)))6 get_tree().quit()TypeScript1const values: number[] = [1, 2, 3, 4];2console.log(JSON.stringify(values.slice(1, -1)));For-of and Array Values
GDScript for value in array visits elements, corresponding to JavaScript for-of. Iterating a GDScript Dictionary instead visits keys; JavaScript for-in also enumerates keys. There is no built-in range syntax required here: for-of already supplies each…
GDScript1extends Node2 3func _ready():4 var total = 05 for value in [3, -1, 2]:6 if value > 0:7 total += value8 print(total)9 get_tree().quit()TypeScript1let total: number = 0;2for (const value of [3, -1, 2]) { if (value > 0) total += value; }3console.log(total);Truthiness Is Not Emptiness
GDScript Array.is_empty directly tests collection emptiness; negating it asks whether any elements exist. JavaScript empty arrays and objects are truthy. The paired examples intentionally print different booleans: an explicit nonempty predicate differs from…
GDScript1extends Node2 3func _ready():4 var values = []5 print(JSON.stringify(not values.is_empty()))6 get_tree().quit()TypeScript1const value: unknown = [];2console.log(Boolean(value));Annotations and Inference
GDScript int and float are distinct runtime Variant types; a typed count can therefore carry integer arithmetic semantics. TypeScript number uses JavaScript floating-point arithmetic for both whole and fractional values. BigInt is a separate runtime type…
GDScript1extends Node2 3func _ready():4 var price: float = 2.55 var count: int = 46 print(price * count)7 get_tree().quit()TypeScript1const price: number = 2.5;2const count = 4;3console.log(price * count);
Syllabus
12 chapters48 lessons1 project48 challenges96 quiz questionsStart Here
1 lessonRuntime Values
4 lessonsRuntime Collections
4 lessonsRuntime Control Flow
4 lessonsRuntime Edge Cases
4 lessonsTyped Contracts
5 lessonsTyped Flow
5 lessonsTyped Functions
5 lessonsTyped Collections
5 lessonsReliable Modules and Objects
5 lessonsProject: Typed Orders
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is TypeScript for GDScript Developers for?
For people who already write GDScript and want to learn TypeScript. Each lesson starts from GDScript 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 GDScript basics: variables, conditions, loops, functions and collections.
How many lessons does TypeScript for GDScript Developers have?
TypeScript for GDScript Developers contains 48 interactive lessons you can complete at your own pace.
What does TypeScript for GDScript Developers cover?
The course is organized into chapters covering: Start Here, Runtime Values, Runtime Collections, Runtime Control Flow, and more.
Is TypeScript for GDScript Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.