Alva.Codegen.TypeMapper (Alva v0.1.0)

Copy Markdown View Source

Maps Ash type specifications to TypeScript type annotations.

Type Mapping

  • :string, :uuid, :ci_string, date/time types → string
  • :integer, :float, :decimalnumber
  • :booleanboolean
  • :mapRecord<string, any>
  • :fileFile (or string[] for arrays of files)
  • {:array, inner}InnerType[]
  • Embedded resources → inline object type
  • Enums → union of string literals
  • Union types (one_of) → union of mapped types
  • Unknown types → any

See Alva.Codegen.InputContract and Alva.Codegen.DtoGenerator for consumers.

Summary

Functions

Maps a single Ash type to its TypeScript equivalent.

Functions

map_type(type, constraints \\ [])

(since 0.1.0)

Maps a single Ash type to its TypeScript equivalent.