Typeri (typeri v0.1.1)
Documentation for Typeri
.
Summary
Functions
Creates a type definition with name (provided atom or string will be transformed to PascalCase)
Creates a type from schema
Functions
@spec to_definition(name :: String.t() | atom(), schema :: Peri.schema()) :: String.t()
Creates a type definition with name (provided atom or string will be transformed to PascalCase)
Examples
iex> Typeri.to_definition(:product, {:required, %{ price: {:required, :integer}, description: :string }})
"export type Product = { description: null | string; price: number };"
@spec to_type(schema :: Peri.schema()) :: String.t()
Creates a type from schema
Examples
iex> Typeri.to_type({:required, :boolean})
"boolean"
iex> Typeri.to_type({:required, %{ name: {:required, :string}, age: :integer }})
"{ name: string; age: null | number }"