Skip to content

default value not checked if the typespec is missing #45

@meox

Description

@meox

I have a typedstruct defined in this way:

defmodule Msg do
    use TypedStruct

    typedstruct do
      field(:version, default: 1)
      field(:note, String.t(), default: "")
    end
end

If I default construct the record in this way: %Msg{} I got

%Msg{version: nil, note: ""}

instead of

%Msg{version: 1, note: ""}

Specifying the typespec everything works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Solved

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions