Skip to content

Type System

This page explains how to think about Targo's type system, not every syntax detail.

The key mental model is simple:

Targo uses TypeScript-shaped syntax to express a Go-first type system.

What changes first

  • number exists, but maps to float64
  • explicit Go numeric types still matter at boundaries
  • conditions should stay explicitly bool
  • class is closer to a Go struct reference model than a JS class runtime
  • string length follows Go-style expectations when Unicode matters

Practical advice

  • default to int for ordinary integer business logic
  • use concrete Go numeric types when width and compatibility matter
  • choose slice<T> first for Go-native data flow
  • reach for Array<T> only when you explicitly want JS-style collection methods