Great article and wow, what a complex and powerful type! Is there a way to get the actual argument (and not its type) recursively? I'm currently trying to create such a type for Solid.js' setStore function, which has basically the following interface:
A selector can be a keyof Item, (keyof Item)[], a range { from: number, to: number } or a filter function. A setter can either be a DeepPartial value of the selected type, undefined or a function that receives the current Item and returns aforesaid values.
¹: each subsequent selector should not receive the Store, but the selection within it.
²: the setter should receive the selection of the last selector.
However, a selector could also be a string or number if the selected item inside the store was an object or array. Unfortunately, if I use
Great article and wow, what a complex and powerful type! Is there a way to get the actual argument (and not its type) recursively? I'm currently trying to create such a type for Solid.js' setStore function, which has basically the following interface:
A selector can be a
keyof Item,(keyof Item)[], a range{ from: number, to: number }or a filter function. A setter can either be a DeepPartial value of the selected type, undefined or a function that receives the current Item and returns aforesaid values.¹: each subsequent selector should not receive the Store, but the selection within it.
²: the setter should receive the selection of the last selector.
However, a selector could also be a string or number if the selected item inside the store was an object or array. Unfortunately, if I use
I get the error that my Selectors are matching
undefined. Any ideas or pointers on what I'm doing wrong?