tta small language for TypeScript and TSX

Language

match

Match tags, literals, classes, tuples, guards, and nested payloads as an expression.

example.tt
const label = match (result) {
Ok(value: Some(value: user)) if user.active => user.name,
Ok(value: None()) => "anonymous",
Err(error) => error.message,
_ => "inactive",
};

Features

  • Bindings use field names and may be aliased with field: name.
  • Or-patterns, guards, nested patterns, and tuple product exhaustiveness.
  • String, number, boolean, and bigint literal patterns, plus a final wildcard arm.
  • Class patterns use is Error, dotted constructor paths, and optional property bindings.
  • await stays in the surrounding async owner when the host has a sound statement region.
Nexttry →