First of all, let me just say that I like the new pipe-modules very much. Let' me also say that I'm not sure this is actually a bug. Maybe I'm just doing something wrong. But I felt compelled to choose one of the templates. Last but not least, thank you very much for monocle-ts. It's a great library!
Current Behavior
import * as L from 'monocle-ts/lib/Lens';
interface Persons {
entries: string[];
}
const findWaldo = pipe(
L.id<Persons>(),
L.prop("entries"),
L.findFirst(p => p === "Waldo")
)
This does not compile. The error I get is:
Argument of type '<S>(sa: Lens<S, readonly string[]>) => Optional<S, string>' is not assignable to parameter of type '(b: Lens<Persons, string[]>) => Optional<Persons, string>'.
Types of parameters 'sa' and 'b' are incompatible.
Type 'Lens<Persons, string[]>' is not assignable to type 'Lens<Persons, readonly string[]>'.
Types of property 'set' are incompatible.
Type '(a: string[]) => (s: Persons) => Persons' is not assignable to type '(a: readonly string[]) => (s: Persons) => Persons'.
Types of parameters 'a' and 'a' are incompatible.
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type 'string[]'. TS2345
362 | L.id<Persons>(),
363 | L.prop("entries"),
> 364 | L.findFirst(p => p === "Waldo")
| ^
365 | )
🐛 Bug report
First of all, let me just say that I like the new
pipe
-modules very much. Let' me also say that I'm not sure this is actually a bug. Maybe I'm just doing something wrong. But I felt compelled to choose one of the templates. Last but not least, thank you very much for monocle-ts. It's a great library!Current Behavior
This does not compile. The error I get is:
Expected behavior
It should compile.
Your environment