Skip to content

Missing Dict import when using Elm.Annotation.dict #106

@adamdicarlo0

Description

@adamdicarlo0

The Elm.Annotation.dict function does not, on its own, cause Dict to get imported. I saw this when adding a feature to elm-open-api-cli (permalink that requires clicking 'Load diff' on SchemaUtils.elm).

This rears its head when nothing else in the File calls a Dict function, which is exactly the case when elm-open-api-cli generates an OpenAPI schema's Types.elm module.

SSCCE repository is here, but here's the code that generates a bad module, for reference:

import Elm.Annotation as Type

fileMissingImport : Elm.File
fileMissingImport =
    Elm.file [ "MissingImport" ]
        [ Elm.alias "SomeDict" (Type.dict Type.string Type.int)
        ]

The code it generates:

module MissingImport exposing (..)


type alias SomeDict =
    Dict.Dict String Int

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions