Skip to content

Commit

Permalink
Improve type definition that depends on Elixir version
Browse files Browse the repository at this point in the history
  • Loading branch information
g-andrade committed Oct 14, 2023
1 parent 70eb53e commit 2550220
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/sqids.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ defmodule Sqids do
]

# Enumerable.t/1 is available only on Elixir 1.14+
@type enumerable(t) :: [t] | term
if System.version() |> Version.match?("~> 1.14") do
@type enumerable(t) :: Enumerable.t(t)
else
@type enumerable(t) :: [t] | Enumerable.t()
end
@type enumerable :: enumerable(term)

@enforce_keys [:alphabet, :min_length, :blocklist]
defstruct [:alphabet, :min_length, :blocklist]
Expand Down

0 comments on commit 2550220

Please sign in to comment.