Is there a way to have defaults apply when a key is undefined, in addition to when a key is missing?

example:
let objWithDefault = a.type({nameWithDefault: 'string = "foo"'});
objWithDefault({}); // this works
objWithDefault({ nameWithDefault: undefined }); // this doesn't
let objWithDefault = a.type({nameWithDefault: 'string = "foo"'});
objWithDefault({}); // this works
objWithDefault({ nameWithDefault: undefined }); // this doesn't
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?