How to Convert Types

type UserModel
= Nothing
| TestModel Test.Model

type alias Model =
{ url: Url.Url
, key: Nav.Key
, count: Int
, newmodel: UserModel
}

TYPE MISMATCH - I cannot update the newmodel field like this:

74| ( { model | newmodel = testmodel }, Cmd.none)
#^^^^^^^^^#
This testmodel value is a:

#Test.Model#

But it should be:

#UserModel#

It seems like you need ( { model | newmodel = TestModel testmodel }, Cmd.none)

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.