typed_struct icon indicating copy to clipboard operation
typed_struct copied to clipboard

Best way to use derive with `typedstruct module: .... do`

Open tcoopman opened this issue 1 year ago • 0 comments

This is what I want to write:

@derive Jason.Encoder
typedstruct module: Foo do
  field :bar, :string
end
> mix compile
warning: warning: module attribute @derive was set after defstruct, all @derive calls must come before defstruct

To fix it I have to use

require Protocol
Protocol.derive(Jason.Encoder, Foo)

tcoopman avatar Feb 12 '23 12:02 tcoopman