Skip to content

Hint on using types / type aliases #366

@EvansJahja

Description

@EvansJahja

Say we have the following import
import Html

and later

view : Model -> Html Msg

A beginner to elm like myself would be very confused seeing the following error message

I cannot find a `Html` type:

32| view : Model -> Html Msg
                    ^^^^
These names seem close though:

    Bool
    Cmd
    Char
    Int

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.

What do you mean? Html is right there!


What I would expect to happen:

A more helpful error message would say something like this:

I cannot find a `Html` type. I do see that you have already imported `Html` package, and that contains `Html` type. Perhaps you meant to say `import Html exposing Html`. You could also modify your usage:

32| view : Model -> #Html#.Html Msg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions