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

iso.iso constructor is not equivalent to iso class constructor #166

Open
arthurgubaidullin opened this issue Aug 14, 2021 · 0 comments
Open

Comments

@arthurgubaidullin
Copy link

🐛 Bug report

Current Behavior

composeIso does not accept an instance created via the iso.iso constructor.

Expected behavior

Both constructors must work with composeIso method.

Reproducible example

import { iso, Iso, Lens } from "monocle-ts";

type Input = { data: [string, string][] };

type Output = { data: { [id: string]: string } };

const data = Lens.fromProp<Input>()("data");

const iso1 = new Iso<Input["data"], Output["data"]>(
  () => {
    throw new Error("unimplemented");
  },
  () => {
    throw new Error("unimplemented");
  }
);

const iso2 = iso.iso<Input["data"], Output["data"]>(
  () => {
    throw new Error("unimplemented");
  },
  () => {
    throw new Error("unimplemented");
  }
);

data.composeIso(iso1); // this works!

data.composeIso(iso2); // type check error: Type 'Iso<[string, string][], { [id: string]: string; }>' is missing the following properties from type 'Iso<[string, string][], { [id: string]: string; }>': _tag, unwrap, to, wrap, and 19 more.

My environment

Software Version(s)
monocle-ts 2.3.10
fp-ts 2.11.1
TypeScript 3.9.10
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

No branches or pull requests

1 participant