ruls icon indicating copy to clipboard operation
ruls copied to clipboard

Custom signals support

Open MarceloPrado opened this issue 1 year ago • 1 comments

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:

const dateSignal = signal.type<Date>(z.date().parse)

I'm trying to understand how to enhance its types to support operations besides the basic ones:

CleanShot 2023-07-01 at 18 18 50@2x

Given dates are a non-trivial type, it would be awesome if I could add operations like isSameDay, isAfter, isBefore, etc.

MarceloPrado avatar Jul 01 '23 21:07 MarceloPrado