Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evolve throws while absent of corresponding transformations #1718

Open
imcotton opened this issue Jun 8, 2022 · 0 comments · May be fixed by #1719
Open

evolve throws while absent of corresponding transformations #1718

imcotton opened this issue Jun 8, 2022 · 0 comments · May be fixed by #1719

Comments

@imcotton
Copy link
Contributor

imcotton commented Jun 8, 2022

🐛 Bug report

Current Behavior

evolve from struct throws while having absent transformations:

node_modules/fp-ts/lib/struct.js:78
            out[k] = transformations[k](a[k]);
                                       ^

TypeError: transformations[k] is not a function
    at node_modules/fp-ts/lib/struct.js:78:40

Expected behavior

Leaves unspecified entries untouched.

Reproducible example

const { pipe, identity } = require('fp-ts/function')
const { singleton } = require('fp-ts/ReadonlyRecord')
const { evolve } = require('fp-ts/struct')

// Expected { a: 1 }
const result = pipe(
    singleton('a', 1),
    evolve({
        b: identity,
    }),
)

Suggested solution(s)

Check before invoking transformations.

Additional context

Expected behavior would align with the evolve from Ramda as well.

Your environment

Did this work in previous versions of fp-ts? no

Which versions of fp-ts are affected by this issue?

Software Version(s)
fp-ts 2.11
2.12
TypeScript 4.7



@imcotton imcotton linked a pull request Jun 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant