Hello,
Is there a way to combine types? It would be awesome to be able to do |> for Map.merge
defmodule JEC.Types do
@type network_identifier :: %{
network_identifier: %{
network: String.t()
}
}
@type public_key :: %{
public_key: %{
hex: String.t()
}
}
@type derive_account_identifier :: network_identifier() |> Map.merge(public_key())
end
When i try the above i get this error
(CompileError) type |>/2 undefined (no such type in Radixir.Types)
Stacktrace:
│ (elixir 1.13.2) lib/kernel/typespec.ex:923: Kernel.Typespec.compile_error/2
│ (elixir 1.13.2) lib/kernel/typespec.ex:307: Kernel.Typespec.translate_type/2
│ (stdlib 3.17) lists.erl:1358: :lists.mapfoldl/3
│ (stdlib 3.17) lists.erl:1359: :lists.mapfoldl/3
│ (elixir 1.13.2) lib/kernel/typespec.ex:235: Kernel.Typespec.translate_typespecs_for_module/2
But doing this work
defmodule JEC.Types do
@type network_identifier :: %{
network_identifier: %{
network: String.t()
}
}
@type public_key :: %{
public_key: %{
hex: String.t()
}
}
@type derive_account_identifier :: Map.merge(network_identifier(), public_key())
end
Im going to need to merge a lot @type so doing the Map.merge would get pretty messy.
Any ideas / help would be much appreciated.