View Source TypeCheck.Builtin.OptionalFixedMap (TypeCheck v0.13.7)
Checks whether the value is a map with a optional set of keys
On failure returns a problem tuple with:
:not_a_map
if the value is not a map:superfluous_keys
if the value have any keys other than the expected keys. The extra information contains in this case:keys
with a list of keys that are superfluous.:value_error
if one of the elements does not match. The extra information contains in this case:problem
and:key
to indicate what and where the problem occurred.
Summary
Types
@type problem_tuple() :: {t(), :not_a_map, %{}, any()} | {t(), :superfluous_keys, %{keys: [atom()]}, map()} | {t(), :value_error, %{problem: TypeCheck.TypeError.Formatter.problem_tuple(), key: any()}, map()}
(This type is managed by TypeCheck
,
which allows checking values against the type at runtime.)
Full definition:
problem_tuple :: {t(), :not_a_map, %{}, any()}
| {t(), :superfluous_keys, %{keys: list(atom())}, map()}
| {t(), :value_error, %{problem: lazy(TypeCheck.TypeError.Formatter.problem_tuple()), key: any()},
map()}
@type t() :: %TypeCheck.Builtin.OptionalFixedMap{ keypairs: [{term(), TypeCheck.Type.t()}] }
(This type is managed by TypeCheck
,
which allows checking values against the type at runtime.)
Full definition:
t :: %TypeCheck.Builtin.OptionalFixedMap{keypairs: list({term(), TypeCheck.Type.t()})}