can `optional()` be used with a thunk?
I want to do something like this (to allow null values to be ignored):
But I get the error:
Type definitions must be strings or objects (was Function)
I am needing to use a thunk because in my real case I am using a type defined within the scope. But maybe there's another way of achieving that?4 Replies
Could you just use a normal optional key like
"field?"
yeah, sort of. I was doing that originally, but started getting
An unordered union of a type including a morph and a type with overlapping input is indeterminate
. But now I think about it, I suspect I would probably get the same issue even with .optional()
?Yeah they're functionally identical
I haven't managed to reduce this down to a simple example yet, maybe I'll do that so I can understand what's going on