# `Zoi.TypeSpec`
[🔗](https://github.com/phcurado/zoi/blob/v0.17.4/lib/zoi/type_spec.ex#L1)

Protocol for generating Elixir type specifications from Zoi schemas.

Each type can implement this protocol to define how it should be represented
as an Elixir typespec. This is used by `Zoi.type_spec/1` to generate type
specifications that can be used with `@type` attributes.

## Example

    defmodule MyCustomType do
      use Zoi.Type.Def

      defimpl Zoi.TypeSpec do
        def spec(_schema, _opts) do
          quote(do: my_custom_type())
        end
      end
    end

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `spec`

```elixir
@spec spec(Zoi.schema(), Zoi.options()) :: Macro.t()
```

Returns a quoted Elixir type specification for the given schema.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
