Skip to content

Commit

Permalink
Merge pull request #79 from katehedgpeth/main
Browse files Browse the repository at this point in the history
fix typespecs in LiveViewNative module
  • Loading branch information
supernintendo authored Dec 9, 2023
2 parents 7e33056 + 871a184 commit a18fad8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/live_view_native.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule LiveViewNative do
Used to introspect platforms at compile-time or runtime.
"""
@spec platform(atom) :: {:ok, %LiveViewNativePlatform.Env{}} | :error
@spec platform(atom | String.t()) :: {:ok, %LiveViewNativePlatform.Env{}} | :error
def platform(platform_id) when is_atom(platform_id) and not is_nil(platform_id),
do: platform("#{platform_id}")

Expand Down Expand Up @@ -51,6 +51,6 @@ defmodule LiveViewNative do
@doc """
Returns a list of environment structs for all LiveView Native platforms.
"""
@spec platforms() :: list(%LiveViewNativePlatform.Env{})
@spec platforms() :: LiveViewNative.Platforms.env_platforms_map()
def platforms, do: env_platforms()
end
5 changes: 5 additions & 0 deletions lib/live_view_native/platforms.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
defmodule LiveViewNative.Platforms do
@moduledoc false

@type env_platforms_map() :: %{
String.t() => %LiveViewNativePlatform.Env{}
}

@default_platforms [LiveViewNative.Platforms.Web]

@env_platforms :live_view_native
Expand All @@ -23,6 +27,7 @@ defmodule LiveViewNative.Platforms do
which is responsible for determining which platform (web, iOS, etc.) a
session originates from.
"""
@spec env_platforms() :: env_platforms_map()
def env_platforms do
@env_platforms
|> Enum.map(&expand_env_platform/1)
Expand Down

0 comments on commit a18fad8

Please sign in to comment.