Ben M
Ben M
Ahh! That makes **way** more sense to me. Thank you! So this is the same: ``` b: input => input.map(val => [[(val) => false, 'msg']]) c: Ramda.map([[(val) => false, 'msg']])...
Of course this can be restricted. TypeScript has an extremely mighty type system - in fact often overwhelming. You can have recursive structures, and you can have conditional types in...
And for: ``` const data = { foo: ["a", "b", "c"] } ``` too?
Let's clarify: ``` if INPUT is Array then allow: [[...]] (val) => ... if INPUT is Object then allow: [[...]] (val) => ... { ... } else allow: [[...]] ```
Thanks a lot! I guess that's it for the day... Now I have to see what TypeScript is capable of 😆 (or what I am capable of)
But I want to use it as soon as possible with TypeScript ;)
Yes this works. But again there are problems with type inference for tuples :( ``` const data = { b: ["a", "b"] } const rules: Spec = { b: input...
It's getting better and better! I've renamed all the types and added some more: - `SpecArray` is `[[...]]` - `SpecFunction` is `(value) => ...` - If `value` is an array,...
I just played some more with the typings. It's driving me nuts! 🤣 **First:** VSCode sometimes takes really long to refresh the typings in my code after I changed the...
Thank you! :) I guess root validation would basically just the code "within" the `reduce` of the `validate` method. Something like this might work (pseudo code): ```js const validate =...