These are chat archives for ramda/ramda
Just for kicks, I decided to give TS a spin in a large-ish JS codebase. I expected errors all over the place just because such things happen. But I couldn't fix the errors.
pipe confuse the type-checker, and I have
pipe all over my code. "Expected 0 arguments, got 1 instead."
PS: In case you didn't know, you can very easily get static typechecking for your JS files (!) without having to convert it to TS. If you're using VSCode, you don't even need to install anything. Just set
--checkJsflag. You don't need to make any changes to your code. You can later add additional type information if you want, using JSDoc comments. Details here.
--strictNullCheckscome pretty close to satisfying the use-cases of the Maybe monad. Sure, they aren't as elegant as the corresponding FP solutions to these problems, but they're strictly enforced, which I'd argue is more valuable. Also, the intellisense you get with TS in VSCode (and I'm sure elsewhere) is just awesome. You won't need to ever again switch to another file to see what the arguments of that function are, or what are the keys on that object.
// [bool] => int const toInt = R.pipe( R.map(x => x ? '1' : '0'), R.join(''), x => parseInt(x, 2) ) lg(toInt([true, false, true])) // => 5
eitheretc? Monet.js? And why isn't it part of the core Ramda?