Z
Zod•3y ago
Scott Trinh

.record() question

Do you have strict mode on in your TypeScript config?
22 Replies
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Hmm... I know at one point there was a request to make this explicitly partial but I didn't think we actually went that way. Lemme look
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Well object schemas are required by default this is a record schema.
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
It looks like it falls through to partial if the keys are not explicitly string number or symbol.
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
No I think your doing the right thing philosophically it's just possible we aren't handling the enum case properly
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Not sure just now I'm away from my computer 🥲
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
I'm trying to see if I can point you in a helpful direction 🤔
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Yeah somehow it is not falling into the case where your enum types extend string but I can't quite think of why. What's the inferred type of your features enum?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Actually I have no idea what TypeOf is lmao
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
At any rate that type clearly extends string unless there is some rule about string enums that I don't know about What version of Zod are you on?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Haven't really found anything out here other than to notice that string enums do indeed fall into the bottom of that else clause.
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Scott Trinh
Scott Trinh•3y ago
Not that I've found 😞
Want results from more Discord servers?
Add your server