v6 Types

Why type checks

  • catch many runtime errors earlier
  • make exports callable by contract
  • stabilize module boundaries

Type model

  • primitives: number, bool, string, nil
  • containers: array<T>, map<K, V>
  • function: fn(params...) -> T
  • unknown placeholder for ambiguous inference paths

Assignability

  • structural matching
  • nil-compatible with any type
  • unknown is permissive placeholder
  • function calls verify arity + per-arg assignability

Inference

  • from initializer / usage / context
  • empty arrays/maps need contextual type
  • ambiguous cases produce cannot infer type

Checker responsibilities

  • declarations and assignment
  • binary/boolean operators
  • call target and return checks
  • module exports/member call signatures

Practical checks

  • array/map element and key typing
  • missing return paths
  • call of non-function
  • unknown export call type mismatch
1 / 1
Use arrow keys or click edges to navigate. Press H to toggle help, F for fullscreen.