Closed SimonAM closed 2 years ago
added documentation for pick.
Pick returns undefined on missing values. This behavior differs from the ramda implementation and should be clear to the user.
The example you provided doesn't typecheck:
pipe({ a: 1, b: 'two' }, pick(['a', 'c']))
Type '"c"' is not assignable to type '"a" | "b"'.
Ok. I'm really new to typescript. Do you know why i'm not getting the error on my stackblitz application?
Your import should be from fp-ts-std/Record
.
Ah yes wonderful, now i see the type error! However, this doesn't allow the code to run on stackblitz because of conditional imports not working. Shouldn't #7 be open or is there something that I'm missing?
That website doesn't work in my browser so I can't offer very specific advice, but per the README:
fp-ts-std is published with both ESM and CJS modules. The import paths in either case needn't change and the appropriate module resolution should be picked up by Node and your bundler, however if your environment doesn't support conditional exports you'll need to import directly from a dist/(cjs|esm)/ subdirectory. Given ESM modules the library should tree shake well.
We use the library at work with Webpack (ESM), and it runs okay in Node for me locally (CJS):
> R = require('fp-ts-std/Record')
> R.pick.name
'pick'
Thanks for this, mostly incorporated in https://github.com/samhh/fp-ts-std/commit/3ffee45ac9c528ca6616896104a76605f0346229.
Changed links which references fp-ts-std where it should be fp-ts. Removed links to functions that does not exist.
anyPass : refers to anyPass. No such function anywhere. allPass : refers to all Pass. No such function anywhere. either : refers to boolean::either. No such function.