Closed muelli closed 6 years ago
Hello @muelli, thanks for reporting the issue. Could you try pasting the source code of your Main.elm
file here and tell me if you see any parse errors? http://bogdanp.github.io/elm-ast/example/
If there are errors there, then the issue is with the underlying elm-ast package.
Regardless, that error message should be more clear.
I've pasted
port module Main exposing (..)
init location =
let
currentRoute =
Routing.parseLocation location
in
--( initialModel currentRoute, fetchUser )
( initialModel currentRoute, Cmd.batch
[ check "yo"
, fetchUser
] )
into http://bogdanp.github.io/elm-ast/example/ and it fails:
Err ((),{ data = "port module Main exposing (..)\n\n\ninit location =\n let\n currentRoute =\n Routing.parseLocation location\n in\n --( initialModel currentRoute, fetchUser )\n ( initialModel currentRoute, Cmd.batch\n [ check \"yo\"\n , fetchUser\n ] )\n\n", input = "init location =\n let\n currentRoute =\n Routing.parseLocation location\n in\n --( initialModel currentRoute, fetchUser )\n ( initialModel currentRoute, Cmd.batch\n [ check \"yo\"\n , fetchUser\n ] )\n\n", position = 33 },["expected end of input"])
I believe it's proper Elm though. When removing the comment, it works better.
@muelli yes, I've seen proper elm fail to parse in that package before. Would you mind opening an issue for the https://github.com/Bogdanp/elm-ast package?
I'll leave this issue open to track making the error messaging more informative in elm-typescript-interop
when the parsing fails.
Just to update this thread, it looks like a workaround for this issue will be included in the next major version of elm-ast
: https://github.com/Bogdanp/elm-ast/issues/41#issuecomment-357274573.
I'm working on moving over to https://github.com/tunguski/elm-ast which seems to fix this issue. However, I'm not sure what the status is of that package, so we may not be able to rely on that for too long. I opened an issue to get a sense: https://github.com/tunguski/elm-ast/issues/33.
I'll post back here when I publish a fix with comment parsing working!
Hello! I pushed a fix for this @muelli. See the changelog for npm version 0.0.5.
Note that I still need to make a couple of changes to get this parsing Elm 0.19 program types properly. If you're still on 0.18, would you mind checking how this works with your project now? This particular issue should be resolved, but I'd love your overall feedback.
Thank you!
could it be that the interop program trips over compiler warnings?
I get this failure:
However, it compiles, although with a warning: