Validating non-enumerable properties is cumbersome, since they are not taken into account by io-ts codecs (to my knowledge):
import * as t from "io-ts";
import { isLeft } from "fp-ts/Either";
const e = new Error("ENOENT");
const validation = t.type({ message: t.string }).decode(e);
console.log(isLeft(validation)); // true
console.log(e.message); // ENOENT
Desired Behavior
Validating non-enumerable properties is easy.
Suggested Solution
I am not sure whether the solution is...
To have io-ts codecs also check non-enumerable properties by default
To have an additional wrapper that explicitely checks non-enumerable properties, a la
🚀 Feature request
Current Behavior
Validating non-enumerable properties is cumbersome, since they are not taken into account by
io-ts
codecs (to my knowledge):Desired Behavior
Validating non-enumerable properties is easy.
Suggested Solution
I am not sure whether the solution is...
io-ts
codecs also check non-enumerable properties by defaultfp-ts
Who does this impact? Who is this for?
Advance TS users who do not want to use
any
incatch
blocksDescribe alternatives you've considered
Alternative 1: Disable TypeScript
Alternative 2: Manual validation
Alternative 3: io-ts cumbersome validation
Additional context
Hey @gcanti , huge fan here! I love fp-ts :D I would be willing to implement this feature if you would like to have it in
io-ts
orfp-ts
Your environment