Skip to content

remove fails to remove root level props #37

@svarlet

Description

@svarlet

🐛 Bug report

I want to remove a property at the root of an object.

Current Behavior

import { pipe } from "fp-ts/function";
import { remove } from "spectacles-ts";

it("remove", () => {
  expect(pipe({ x: 1, y: 2 }, remove("x"))).toStrictEqual({ y: 2 });
});

Output:

✕ remove (5 ms)

  ● remove

    expect(received).toStrictEqual(expected) // deep equality

    - Expected  - 0
    + Received  + 2

      Object {
    +   "": Object {},
    +   "x": 1,
        "y": 2,
      }

      3 |
      4 | it("remove", () => {
    > 5 |   expect(pipe({ x: 1, y: 2 }, remove("x"))).toStrictEqual({ y: 2 });
        |                                             ^
      6 | });
      7 |

Expected behavior

I expect it to return

{ y: 2 }

Reproducible example

Suggested solution(s)

Additional context

Your environment

Which versions of fp-ts are affected by this issue? Did this work in previous versions of fp-ts?

Software Version(s)
spectacles-ts 1.0.7
fp-ts 2.12.2
TypeScript 4.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions