data class User(name: String, pass: String, email: String, etc...)
and then an update method which would take a Partial User so that you'd only have to supply a subset of the fields
fun update(user: Partial<User>): User {...}
. Should I just create a new type for this? Such as
data class PartialUser(name?: String = null, pass?: String = null, email: String = null, etc...)
.
s
serebit
05/31/2019, 7:52 PM
You’ll have to create a second type, yes
👍 1
n
nk
05/31/2019, 9:33 PM
Thanks, good to know what's possible/isn't possible. I ended up creating separate types for create/update in the end. I think its better than partial anyway because their accepted fields vary slightly.