In the following codec definition, I'm expecting Foo.foo to be of type unknown | undefined just like Foo.bar is. Is there something special about unknown or is this a bug?
import * as pur from "purify-ts";
export const fooCodec = pur.Codec.interface({
foo: pur.optional(pur.unknown),
bar: pur.optional(pur.boolean),
});
export type Foo = pur.GetType<typeof fooCodec>;
That is a feature of TypeScript, it's the same with any | undefined. Because unknown includes undefined in itself it doesn't make a lot of sense to keep it in the definition.
First off, thanks for the great lib! ;)
In the following codec definition, I'm expecting
Foo.foo
to be of typeunknown | undefined
just likeFoo.bar
is. Is there something special aboutunknown
or is this a bug?