🐛 Bug report
Current Behavior
Hi
Thanks for this awesome library! I think the type of the Path to traverse a Record with fixed Keys is wrong.
type A = {
b: Record<string, C>;
};
type AWithFixedKeys = {
b: Record<"c", C>;
};
type C = {
d: string;
};
const anA: A = { b: { someKey: { d: "test" } } };
const anAWithKeys: AWithFixedKeys = { b: { c: { d: "test" } } };
const setA = pipe(anA, set("b.{}>.d", "someValue"));
const setAKeys = pipe(anAWithKeys, set("b.{}>.d", "someOtherValue"));
const getA = pipe(setA, get("b.{}>.d"));
const getAKeys = pipe(setAKeys, get("b.{}>.d"));
console.log({ getA }, { getAKeys });
The return value is okay:
{ getA: [ 'someValue' ] } { getAKeys: [ 'someOtherValue' ] }
But on the 2 paths i get the following error:
src/entries.ts:117:42 - error TS2345: Argument of type '"b.{}>.d"' is not assignable to parameter of type '"" | "b" | "b.c" | "b.c.d"'.
117 const setAKeys = pipe(anAWithKeys, set("b.{}>.d", "someOtherValue"));
~~~~~~~~~
src/entries.ts:120:39 - error TS2345: Argument of type '"b.{}>.d"' is not assignable to parameter of type '"" | "b" | "b.c" | "b.c.d"'.
120 const getAKeys = pipe(setAKeys, get("b.{}>.d"));
~~~~~~~~~
Expected behavior
Not have an type error :)
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.11 |
| TypeScript |
4.6.3 |
🐛 Bug report
Current Behavior
Hi
Thanks for this awesome library! I think the type of the Path to traverse a Record with fixed Keys is wrong.
The return value is okay:
But on the 2 paths i get the following error:
Expected behavior
Not have an type error :)
Your environment
Which versions of fp-ts are affected by this issue? Did this work in previous versions of fp-ts?