Skip to content

Migrating from TypeScript

Floe is designed to be familiar to TypeScript developers.

  • Import/export syntax
  • Template literals
  • JSX
  • Async/await
  • Type annotations
  • Generics
TypeScriptFloeExample
functionfnfn greet(name: string) -> string { ... }
: ReturnType-> ReturnTypefn add(a: number, b: number) -> number
.filter().map()|> filter |> mapitems |> filter(.active) |> map(.name)
let / constconst onlyNo mutation
======= compiles to ===
switchmatchExhaustive, no fall-through
try/catchtry expressionconst result = try parseYaml(input)
T | nullOption<T>Some(value) / None
throwResult<T, E>Ok(value) / Err(error)
FeatureWhyAlternative
let / varMutation bugsconst only
classComplex inheritance hierarchiesFunctions + records
thisImplicit context bugsExplicit parameters
anyType safety escapeunknown + narrowing
null / undefinedNullable reference bugsOption<T>
enumCompiles to runtime objectsUnion types
interfaceRedundanttype
switchNo exhaustiveness, fall-throughmatch
for / whileMutation-heavyPipes + map/filter/reduce
throwInvisible error pathsResult<T, E>
returnImplicit returnsLast expression is the return value

Floe compiles to .ts/.tsx, so you can adopt it file by file. Write new files as .fl, compile them alongside your existing .ts files, and your build tool (Vite, Next.js) treats the output as normal TypeScript.