Maps Ash types to TypeScript types using unified type-driven dispatch.
This module provides a unified approach to type mapping with a single core
dispatcher (map_type/3) that handles both input and output directions.
Summary
Functions
Builds a TypeScript map type with optional field filtering and name mapping.
Builds a union input type from spec members (discriminated union syntax).
Builds a union output type from spec members (list of %{name, type} maps).
Generates a TypeScript union of primitive field names.
Maps an Ash type to a TypeScript type for input schemas. Backward compatible wrapper around map_type/3.
Maps an Ash type to a TypeScript type for output schemas. Backward compatible wrapper around map_type/3.
Determines if a union member is a "primitive" (no selectable fields).
Maps an Ash type to a TypeScript type for channel event payloads.
Maps an Ash type to a TypeScript type string.
Raises the canonical "unsupported type" error for a type AshTypescript
cannot map to TypeScript. Accepts a %Ash.Info.Manifest.Type{} or a bare
type module.
Maps a type module the manifest generator could not classify to a TypeScript type, when possible.
Types
Functions
Builds a TypeScript map type with optional field filtering and name mapping.
Builds a union input type from spec members (discriminated union syntax).
Builds a union output type from spec members (list of %{name, type} maps).
Generates a TypeScript union of primitive field names.
Maps an Ash type to a TypeScript type for input schemas. Backward compatible wrapper around map_type/3.
Maps an Ash type to a TypeScript type for output schemas. Backward compatible wrapper around map_type/3.
Determines if a union member is a "primitive" (no selectable fields).
Maps an Ash type to a TypeScript type for channel event payloads.
Like map_type/3 with :output direction, but typed containers (maps/structs
with :fields constraint) generate plain object types without the
__type/__primitiveFields metadata that the RPC field-selection system needs.
Maps an Ash type to a TypeScript type string.
Parameters
type- The Ash type (atom, tuple, or map with :type/:constraints)constraints- Type constraintsdirection- :input or :output
Returns
A TypeScript type string.
@spec raise_unsupported_type!(Ash.Info.Manifest.Type.t() | atom() | binary()) :: no_return()
Raises the canonical "unsupported type" error for a type AshTypescript
cannot map to TypeScript. Accepts a %Ash.Info.Manifest.Type{} or a bare
type module.
@spec unknown_module_mapping(Ash.Info.Manifest.Type.t()) :: {:ok, String.t()} | :unsupported
Maps a type module the manifest generator could not classify to a TypeScript type, when possible.
This is the single accept-list for unclassified (kind: :unknown) type
modules, shared by map_type/3, AshTypescript.Codegen.TypeAliases, and
the compile-time AshTypescript.Manifest.Verifiers.VerifyMappableTypes
verifier: custom types implementing typescript_type_name/0 (or decorated
with a type_name in the manifest), type_mapping_overrides config
entries, and known third-party types with bespoke aliases.