Menu
CoddyTech
Course

Go for TypeScript Developers

Transfer your TypeScript experience to Go: typed values, control flow, slices, functions, methods, interfaces and error handling. Build a tested multi-file order pipeline.

TypeScript and Go side by side

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

  1. Files and the first run

    TypeScript checks JavaScript source before emitting JavaScript. Go builds a native executable from a package with one main entry. Files share package declarations; imports are local to each file.

    TypeScript
    1console.log("TypeScript", 3);2export {};
    Go
    1package main2import ("fmt")3
    4func main(){fmt.Println("Go", 3)}
  2. If and scoped names

    TypeScript narrows unions through conditions, while Go if checks a bool without general union narrowing. Go also permits a short initializer scoped to the complete if/else statement.

    TypeScript
    1const n: number="go".length; if(n>1){console.log("long");}else{console.log("short");}2export {};
    Go
    1package main2import ("fmt")3
    4func main(){if n := len("go"); n > 1 { fmt.Println("long") } else { fmt.Println("short") }}
  3. Arrays are values

    TypeScript tuples constrain positions statically but remain JavaScript array objects. Go [2]int is a fixed-size value type that copies on assignment. A TypeScript tuple annotation does not create that runtime value-copy behavior.

    TypeScript
    1const a: [number,number]=[3,5];const b: [number,number]=[...a];b[0]=9;console.log(a[0],b[0]);2export {};
    Go
    1package main2import ("fmt")3
    4func main(){a:=[2]int{3,5}5b:=a6b[0]=97fmt.Println(a[0],b[0])}
  4. Typed function contracts

    TypeScript function annotations are erased and overload declarations describe one runtime implementation. Go has one explicit signature per function name and no default arguments or overloads. Parameters, including slice descriptors, are copied.

    TypeScript
    1function isEven(n:number):boolean{return n%2===0;}console.log(isEven(6));2export {};
    Go
    1package main2import ("fmt")3func IsEven(n int) bool { return n%2==0 }4func main(){fmt.Println(IsEven(6))}
  5. Struct values

    TypeScript object types describe shapes and are erased; assigning an object still aliases it. Go struct types are concrete runtime value types. A copy separates scalar fields but may retain shared storage through reference-like fields.

    TypeScript
    1type Label={text:string};const a:Label={text:"old"};const b:Label={...a};b.text="new";console.log(a.text,b.text);2export {};
    Go
    1package main2import ("fmt")3type Label struct { Text string }4func main(){a:=Label{Text:"old"}5b:=a6b.Text="new"7fmt.Println(a.Text,b.Text)}
  6. Errors are returned values

    TypeScript cannot generally enforce checked exceptions and caught values may be unknown. Go exposes error results in function signatures. Check a returned error rather than treating every failure as a panic to recover from.

    TypeScript
    1function positive(n:number):number{if(n<=0)throw new Error("not positive");return n;}try{positive(-2);}catch(e:unknown){console.log("rejected");}2export {};
    Go
    1package main2import ("fmt";"errors")3func Positive(n int)(int,error) { if n<=0{return 0,errors.New("not positive")};return n,nil }4func main(){_,e:=Positive(-2)5fmt.Println(e!=nil)}

Syllabus

9 chapters48 lessons1 project48 challenges99 quiz questions

More courses for TypeScript developers

Learn Go from another language

Frequently asked questions

Who is Go for TypeScript Developers for?

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

Do I need to know Go already?

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

How many lessons does Go for TypeScript Developers have?

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

What does Go for TypeScript Developers cover?

The course is organized into chapters covering: Values and expressions, Control flow, Collections, Functions and pointers, and more.

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

Get started