Declares the props of Inertia pages. mix typelizer.gen writes one TypeScript props
interface per page component, and Typelizer.InertiaPage.ValidateProps checks the
rendered props in dev and test.
defmodule MyAppWeb.TaskController do
use MyAppWeb, :controller
use Typelizer.InertiaPage
page "tasks/index",
props: [
tasks: {:list, MyAppWeb.TaskSerializer},
filters: :map,
stats: {:optional, {:object, open: :integer, done: :integer}}
]
endShared props (added to every page by a plug) are declared once, in one module:
defmodule MyAppWeb.InertiaShared do
use Typelizer.InertiaPage
shared current_user: {:nullable, MyAppWeb.UserSerializer}, locale: :string
endSee the Inertia guide.
Summary
Functions
Declares the props of a page component.
Declares the shared props: the props that a plug adds to every page. Only one module
of the app may declare them. errors and flash are always included.
Functions
Declares the props of a page component.
Options
:props- required. A keyword list of prop name → type spec. Wrap a spec in{:optional, spec}for a prop that is not always sent (for example a deferred prop).:name- the TypeScript interface name. Default: the component in PascalCase plusProps("tasks/index"→TasksIndexProps).