You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After reading the Custom Type docs, I tried creating a custom date signal. I'm not sure the right way of injecting custom assert functions. For example, the number operator adds its own set of functions. I would like to do the same for my types.
For example:
constdateSignal=signal.type<Date>(z.date().parse)
I'm trying to understand how to enhance its types to support operations besides the basic ones:
Given dates are a non-trivial type, it would be awesome if I could add operations like isSameDay, isAfter, isBefore, etc.
The text was updated successfully, but these errors were encountered:
Then, I can use the number assertions to achieve my goal.
Nonetheless, I'm really curious if my idea above is even possible. I've looked at the internals, but I need some time to get familiar with the TS gymnastics that happens in the signal/factory.ts 😂
After reading the Custom Type docs, I tried creating a custom
date
signal. I'm not sure the right way of injecting custom assert functions. For example, the number operator adds its own set of functions. I would like to do the same for my types.For example:
I'm trying to understand how to enhance its types to support operations besides the basic ones:
Given dates are a non-trivial type, it would be awesome if I could add operations like
isSameDay
,isAfter
,isBefore
, etc.The text was updated successfully, but these errors were encountered: