Skip to content

default value not checked if the typespec is missing #45

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions