Hi, I have a module which is my behaviour:
defstruct [:ip, :endpoint, :conn, :user_id]
@type user_id() :: Ecto.UUID.t()
@type ip() :: String.t() # User's IP from both side endpoints connections
@type endpoint() :: :html | :api # API, HTML
@type conn() :: Plug.Conn.t()
@type ref() :: :on_user_after_logout # Name of this event
@type reason() :: map() | String.t() # output of state for this event
@type registerd_info() :: MishkaInstaller.PluginState.t() # information about this plugin on state which was saved
@type state() :: %__MODULE__{ip: ip(), endpoint: endpoint(), conn: conn(), user_id: user_id()}
@type t :: state() # help developers to keep elixir style
@type optional_callbacks :: {:ok, ref(), registerd_info()} | {:error, ref(), reason()}
@callback initial(list()) :: {:ok, ref(), list()} | {:error, ref(), reason()} # Register hook
@callback call(state()) :: {:reply, state()} | {:reply, :halt, state()} # Developer should decide what and Hook call function
now if I create a function call
like this:
@spec call(OnUserAfterLogout.t()) :: {:reply, OnUserAfterLogout.t()}
def call(%OnUserAfterLogout{} = state) do
create_user_permissions_on_state(state.user_id)
{:reply, state}
end
I get this error:
Function:
MishkaUser.CorePlugin.Login.SuccessLogout.call/1
Success typing:
@spec call(%MishkaInstaller.Reference.OnUserAfterLogout{
:user_id => atom() | %{:id => <<_::288>>, _ => _},
_ => _
}) ::
{:reply,
%MishkaInstaller.Reference.OnUserAfterLogout{
:user_id => atom() | %{:id => <<_::288>>, _ => _},
_ => _
}}
If I change @type user_id()
to any()
or atom() | %{:id => <<_::288>>}
my problem is fixed.
I do not know why I have this problem, I just want to load Ecto.UUID.t()
Am I missing something?