elm-form
elm-form copied to clipboard
Define and expose a type alias for the callback argument in `withOnSubmit`
This signature for withOnSubmit looks like this:
withOnSubmit : ({ fields : List ( String, String ), method : Method, action : String, parsed : Validated error parsed } -> msg) -> Options error parsed input oldMsg extras -> Options error parsed input msg extras
This anonymous record has to be re-defined by consumers of this package any time they want to use this function:
{ fields : List ( String, String )
, method : Method
, action : String
, parsed : Validated error parsed
}
It would be convenient if a type alias was defined and exposed for this that we could reuse when defining a message constructor to be used with withOnSubmit.
This anonymous record has to be re-defined by consumers of this package any time they want to use this function.
I'm not sure I understand, why does a type alias need to be defined to use the function?
Because when I'm defining my Msg type, I have to do
type Msg
= OnSubmit
{ action : String
, method : Form.Method
, fields : List ( String, String )
, parsed : Form.Validated String PersonalInfo
}
It would be nice to be able to just do something like
type Msg
= OnSubmit Form.OnSubmitArgs