premailex
premailex copied to clipboard
Fix Dialyzer typing for to_inline_css options
I tried to specify the css_selector option in Premailex.to_inline_css and Dialyzer complained:
lib/project/mailer.ex:17:22:call
The function call will not succeed.
Premailex.to_inline_css(binary(), [
{:css_selector, binary()}
])
will never return since the 2nd arguments differ
from the success typing arguments:
(binary(), nil | [%{:rules => [map()], :selector => binary(), :specificity => number()}]) ::
:ok
def a() do
:ok
end
This patch improves the spec for Premailex.HTMLInlineStyles.process to allow the second argument to be either a list of CSS Parser rule sets or a keyword list, which matches the implementation.