First of all, great work guys! I love using yup!!
I did however encounter an issue with InferType as shown below:
export const FullAddressValidation = object({
placeId: string().required(),
apartment: string()
.nullable()
.notRequired(),
});
export type FullAddresValidationType = InferType<typeof FullAddressValidation>;
export const UserDetailsValidation = object({
address: FullAddressValidation,
});
export type UpdateUserValidationType = InferType<typeof UserDetailsValidation>;
Since apartment is optional, the direct infertype works making the field optional in the type.
In the nested case however, its given the type of null | undefined, but the field is no longer optional.

.
I would also love to echo the "great work" comment. This is so much better than trying to get joi-browser to work. We are having the same issue described above, in a slightly different use case:
const FooSchema = yup.object().shape({
bar: yup.string().notRequired(),
});
class Foo implements yup.InferType<typeof FooSchema> {
public static schema = FooSchema;
public bar?: string;
}
const BarSchema = yup.object().shape({
foos: yup.array().of(Foo.schema),
});
class Bar implements yup.InferType<typeof BarSchema> {
public foos: Foo[];
}
Here's a screenshot of the error:

The error goes away if we change the bar property definition to the following:
note: removed the
?flag and added| undefined
public bar: string | undefined;
Ran to this issue, any ideas how to fix or workaround?
Why was this issue closed? I too am having this issue.


Types aren't maintained here. please direct type feedback to DT and whoever is maintaining them
Most helpful comment
I would also love to echo the "great work" comment. This is so much better than trying to get joi-browser to work. We are having the same issue described above, in a slightly different use case:
Here's a screenshot of the error:
The error goes away if we change the
barproperty definition to the following: