Hi!
Given this snippet of code:
const optionalTest = record({
id: optional(string)
});
const objDecoder = record({
id: number,
name: string,
optionalId: optional(optionalTest),
});
type Obj = decodeType<typeof objDecoder>;
optionalTest returns an empty object when accessing it through objDecoder.
I have used your example code and rewritten it to reproduce the potential bug: https://codesandbox.io/s/typescript-json-decoder-playground-forked-pcx8f7?file=/src/App.tsx
As you can se, typescript complains that id does not exist on an empty object.
Edit: stopped working after upgrading from 1.0.7 to 1.0.10
Is this intentional or a bug? :)
Hi!
Given this snippet of code:
optionalTest returns an empty object when accessing it through objDecoder.
I have used your example code and rewritten it to reproduce the potential bug: https://codesandbox.io/s/typescript-json-decoder-playground-forked-pcx8f7?file=/src/App.tsx
As you can se, typescript complains that
iddoes not exist on an empty object.Edit: stopped working after upgrading from 1.0.7 to 1.0.10
Is this intentional or a bug? :)