新 0.19 项目中 elm/html 样式属性包的问题

Issue with elm/html style attribute package in new 0.19 project

我注意到,在处理新的 Elm 0.19 项目中的一些构建错误时,我在 运行 elm-make 时开始看到如下错误。

50| [ iframe [ src "https://fakeurl.com", height "0", width "0", style [ ( "display", "none" ), ( "visibility", "hidden" ) ], sandbox "" ]

This style call produces:

String -> Attribute msg

But all the previous elements in the list are:

Attribute msg

Hint: Everything in the list needs to be the same type of value. This way you never run into unexpected values partway through. To mix different types in a single list, create a "union type" as described in: http://guide.elm-lang.org/types/union_types.html

这之后的直接错误是:

This argument is a list of type:

List ( String, String )

But style needs the 1st argument to be:

String

据我所知,在 elm-make 抱怨的行中使用 style 属性似乎是预期的用法 对于 elm/html[=35 的最新版本=].

例如

style [ ( "display", "none" ), ( "visibility", "hidden" ) ]

更深入地看,我似乎安装了 elm/html 1.0.0 软件包,而 Elm 0.19 的最新版本是 2.0.0。更奇怪的是,.19 的 elm/html 版本称为 1.0.0 似乎更像是 0.18 的 elm/html 包的副本,称为 ~version 5.0.0~ 这些都有采用列表的较新签名。查看安装在 C:\Users\me\AppData\Roaming\elm[=18=].19.0\package\elm\html.0.0\src\Html 下的实际包,我确实看到签名是 style : String -> String -> Attribute msg,据我所知,它应该只适用于 Elm 0.18 的 elm/html 包 1.0.0 版本.基于此,我只能得出结论,我的 elm/0.19.0 包存储库文件夹中有 0.18 个包。

我的逻辑是正确的还是有其他解释?怎么会变成这样,也许我做错了什么?这是其中一种工具的已知问题吗?我该如何为我的项目解决这个问题,以便我继续前进?

似乎您对 Elm 0.19 中将核心包转移到 elm/ 命名空间感到困惑。 elm-lang/ 命名空间中的包适用于 Elm 0.18。 elm/html 的最新版本是 1.0.0,而 elm-lang/html 的最新版本是 2.0.0。话虽如此,您使用的 elm/html 1.0.0 是正确的,style 的正确签名是 String -> String -> Attribute msg.

release notes for 0.19 中提到了此特定更改。遗憾的是,该文档中没有其他更改,因此如果您 运行 遇到其他麻烦,请在 Slack 上联系其他人。